Statistics
| Branch: | Revision:

ffmpeg / libavcodec / vc9data.h @ 71160c55

History | View | Annotate | Download (12.4 KB)

1 21aa398f Alex Beregszaszi
/**
2
 * @file vc9data.h
3
 * VC9 tables.
4
 */
5
6
#ifndef VC9DATA_H
7
#define VC9DATA_H
8
9
/* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
10
const int16_t vc9_bfraction_lut[23] = {
11
  420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
12
  630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
13
  504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
14
  120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/,
15
  600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/,
16
  525 /*5/8*/, 735 /*7/8*/,
17
  -1 /*inv.*/, 0 /*BI fm*/
18
};
19
const uint8_t vc9_bfraction_bits[23] = {
20
    3, 3, 3, 3,
21
    3, 3, 3,
22
    7, 7, 7, 7,
23
    7, 7, 7, 7,
24
    7, 7, 7, 7,
25
    7, 7,
26
    7, 7
27
};
28
const uint8_t vc9_bfraction_codes[23] = {
29
     0,   1,   2,   3,
30
     4,   5,   6,
31
   112, 113, 114, 115,
32
   116, 117, 118, 119,
33
   120, 121, 122, 123,
34
   124, 125,
35
   126, 127
36
};
37
38
//Same as H.264
39
static const AVRational vc9_pixel_aspect[16]={
40
 {0, 1},
41
 {1, 1},
42
 {12, 11},
43
 {10, 11},
44
 {16, 11},
45
 {40, 33},
46
 {24, 11},
47
 {20, 11},
48
 {32, 11},
49
 {80, 33},
50
 {18, 11},
51
 {15, 11},
52
 {64, 33},
53
 {160, 99},
54
 {0, 1},
55
 {0, 1}
56
};
57
58
/* BitPlane IMODE - such a small table... */
59
static const uint8_t vc9_imode_codes[7] = {
60
  0, 2, 1, 3, 1, 2, 3
61
};
62
static const uint8_t vc9_imode_bits[7] = {
63
  4, 2, 3, 2, 4, 3, 3
64
};
65
66
/* Normal-2 imode */
67
static const uint8_t vc9_norm2_codes[4] = {
68
  0, 4, 5, 3
69
};
70
static const uint8_t vc9_norm2_bits[4] = {
71
  1, 3, 3, 2
72
};
73
74 9c68c65a Michael Niedermayer
static const uint16_t vc9_norm6_codes[64] = {
75 115329f1 Diego Biurrun
0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
76
0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
77
0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
78
0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
79 9c68c65a Michael Niedermayer
};
80
81
static const uint8_t vc9_norm6_bits[64] = {
82 115329f1 Diego Biurrun
 1,  4,  4,  8,  4,  8,  8, 10,  4,  8,  8, 10,  8, 10, 10, 13,
83
 4,  8,  8, 10,  8, 10, 10, 13,  8, 10, 10, 13, 10, 13, 13,  9,
84
 4,  8,  8, 10,  8, 10, 10, 13,  8, 10, 10, 13, 10, 13, 13,  9,
85 9c68c65a Michael Niedermayer
 8, 10, 10, 13, 10, 13, 13,  9, 10, 13, 13,  9, 13,  9,  9,  6,
86
};
87
/* Normal-6 imode */
88
static const uint8_t vc9_norm6_spec[64][5] = {
89
{ 0,  1, 1        },
90
{ 1,  2, 4        },
91
{ 2,  3, 4        },
92
{ 3,  0, 8        },
93
{ 4,  4, 4        },
94
{ 5,  1, 8        },
95
{ 6,  2, 8        },
96
{ 7,  2, 5,  7, 5 },
97
{ 8,  5, 4        },
98
{ 9,  3, 8        },
99
{10,  4, 8        },
100
{11,  2, 5, 11, 5 },
101
{12,  5, 8        },
102
{13,  2, 5, 13, 5 },
103
{14,  2, 5, 14, 5 },
104
{15,  3, 5, 14, 8 },
105
{16,  6, 4        },
106
{17,  6, 8        },
107
{18,  7, 8        },
108
{19,  2, 5, 19, 5 },
109
{20,  8, 8        },
110
{21,  2, 5, 21, 5 },
111
{22,  2, 5, 22, 5 },
112
{23,  3, 5, 13, 8 },
113
{24,  9, 8        },
114
{25,  2, 5, 25, 5 },
115
{26,  2, 5, 26, 5 },
116
{27,  3, 5, 12, 8 },
117
{28,  2, 5, 28, 5 },
118
{29,  3, 5, 11, 8 },
119
{30,  3, 5, 10, 8 },
120
{31,  3, 5,  7, 4 },
121
{32,  7, 4        },
122
{33, 10, 8        },
123
{34, 11, 8        },
124
{35,  2, 5,  3, 5 },
125
{36, 12, 8        },
126
{37,  2, 5,  5, 5 },
127
{38,  2, 5,  6, 5 },
128
{39,  3, 5,  9, 8 },
129
{40, 13, 8        },
130
{41,  2, 5,  9, 5 },
131
{42,  2, 5, 10, 5 },
132
{43,  3, 5,  8, 8 },
133
{44,  2, 5, 12, 5 },
134
{45,  3, 5,  7, 8 },
135
{46,  3, 5,  6, 8 },
136
{47,  3, 5,  6, 4 },
137
{48, 14, 8        },
138
{49,  2, 5, 17, 5 },
139
{50,  2, 5, 18, 5 },
140
{51,  3, 5,  5, 8 },
141
{52,  2, 5, 20, 5 },
142
{53,  3, 5,  4, 8 },
143
{54,  3, 5,  3, 8 },
144
{55,  3, 5,  5, 4 },
145
{56,  2, 5, 24, 5 },
146
{57,  3, 5,  2, 8 },
147
{58,  3, 5,  1, 8 },
148
{59,  3, 5,  4, 4 },
149
{60,  3, 5,  0, 8 },
150
{61,  3, 5,  3, 4 },
151
{62,  3, 5,  2, 4 },
152
{63,  3, 5,  1, 1 },
153
};
154 5e424311 anonymous
155 21aa398f Alex Beregszaszi
/* 4MV Block pattern VLC tables */
156
static const uint8_t vc9_4mv_block_pattern_codes[4][16] = {
157
  { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27,  0, 28,  1,  2,  2},
158
  {  8, 18, 19,  4, 20,  5, 30, 11, 21, 31,  6, 12,  7, 13, 14,  0},
159
  { 15,  6,  7,  2,  8,  3, 28,  9, 10, 29,  4, 11,  5, 12, 13,  0},
160
  {  0, 11, 12,  4, 13,  5, 30, 16, 14, 31,  6, 17,  7, 18, 19, 19}
161
};
162
static const uint8_t vc9_4mv_block_pattern_bits[4][16] = {
163
  { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
164
  { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
165
  { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
166
  { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
167
};
168
169 0d33db8a anonymous
const uint8_t wmv3_dc_scale_table[32]={
170
    0, 4, 6, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21
171 21aa398f Alex Beregszaszi
};
172
173
/* P-Picture CBPCY VLC tables */
174
static const uint16_t vc9_cbpcy_p_codes[4][64] = {
175
  {
176
      0,   1,   1,   4,   5,   1,  12,   4,  13,  14,  10,  11,  12,   7,  13,   2,
177
     15,   1,  96,   1,  49,  97,   2, 100,   3,   4,   5, 101, 102,  52,  53,   4,
178
      6,   7,  54, 103,   8,   9,  10, 110,  11,  12, 111,  56, 114,  58, 115,   5,
179
     13,   7,   8,   9,  10,  11,  12,  30,  13,  14,  15, 118, 119,  62,  63,   3
180
  },
181
  {
182
      0,   1,   2,   1,   3,   1,  16,  17,   5,  18,  12,  19,  13,   1,  28,  58,
183
      1,   1,   1,   2,   3,   2,   3, 236, 237,   4,   5, 238,   6,   7, 239,   8,
184
      9, 240,  10,  11, 121, 122,  12,  13,  14,  15, 241, 246,  16,  17, 124,  63,
185
     18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31, 247, 125
186
  },
187
  {
188
      0,   1,   2,   3,   2,   3,   1,   4,   5,  24,   7,  13,  16,  17,   9,   5,
189
     25,   1,   1,   1,   2,   3,  96, 194,   1,   2,  98,  99, 195, 200, 101,  26,
190
    201, 102, 412, 413, 414,  54, 220, 111, 221,   3, 224, 113, 225, 114, 230,  29,
191
    231, 415, 240,   4, 241, 484,   5, 243,   3, 244, 245, 485, 492, 493, 247,  31
192
  },
193
  {
194
      0,   1,   1,   1,   2,   2,   3,   4,   3,   5,   6,   7,   8,   9,  10,  11,
195
     12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,
196
     28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,
197
     44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  28,  29,  30,  31
198
   }
199
};
200
static const uint8_t vc9_cbpcy_p_bits[4][64] = {
201
  {
202
    13,  6,  5,  6,  6,  7,  7,  5,  7,  7,  6,  6,  6,  5,  6,  3,
203
     7,  8,  8, 13,  7,  8, 13,  8, 13, 13, 13,  8,  8,  7,  7,  3,
204
    13, 13,  7,  8, 13, 13, 13,  8, 13, 13,  8,  7,  8,  7,  8,  3,
205
    13, 12, 12, 12, 12, 12, 12,  6, 12, 12, 12,  8,  8,  7,  7,  2
206
  },
207
  {
208
    14,  3,  3,  5,  3,  4,  5,  5,  3,  5,  4,  5,  4,  6,  5,  6,
209
     8, 14, 13,  8,  8, 13, 13,  8,  8, 13, 13,  8, 13, 13,  8, 13,
210
    13,  8, 13, 13,  7,  7, 13, 13, 13, 13,  8,  8, 13, 13,  7,  6,
211
    13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  8,  7
212
  },
213
  {
214
    13,  5,  5,  5,  4,  4,  6,  4,  4,  6,  4,  5,  5,  5,  4,  3,
215
     6,  8, 10,  9,  8,  8,  7,  8, 13, 13,  7,  7,  8,  8,  7,  5,
216
     8,  7,  9,  9,  9,  6,  8,  7,  8, 13,  8,  7,  8,  7,  8,  5,
217
     8,  9,  8, 13,  8,  9, 13,  8, 12,  8,  8,  9,  9,  9,  8,  5
218
  },
219
  {
220
     9,  2,  3,  9,  2,  9,  9,  9,  2,  9,  9,  9,  9,  9,  9,  9,
221
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
222
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
223
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8
224
  }
225
};
226
227 e5540b3f anonymous
/* MacroBlock Transform Type: 7.1.3.11, p89
228 21aa398f Alex Beregszaszi
 * 8x8:B
229
 * 8x4:B:btm  8x4:B:top  8x4:B:both,
230
 * 4x8:B:right  4x8:B:left  4x8:B:both
231
 * 4x4:B  8x8:MB
232
 * 8x4:MB:btm  8x4:MB:top  8x4,MB,both
233
 * 4x8,MB,right  4x8,MB,left
234
 * 4x4,MB                               */
235
static const uint16_t vc9_ttmb_codes[3][16] = {
236
  {
237
    0x0003,
238
    0x002E, 0x005F, 0x0000,
239
    0x0016, 0x0015, 0x0001,
240
    0x0004, 0x0014,
241
    0x02F1, 0x0179, 0x017B,
242
    0x0BC0, 0x0BC1, 0x05E1,
243
    0x017A
244
  },
245
  {
246
    0x0006,
247
    0x0006, 0x0003, 0x0007,
248
    0x000F, 0x000E, 0x0000,
249
    0x0002, 0x0002,
250
    0x0014, 0x0011, 0x000B,
251
    0x0009, 0x0021, 0x0015,
252
    0x0020
253
  },
254
  {
255
    0x0006,
256
    0x0000, 0x000E, 0x0005,
257
    0x0002, 0x0003, 0x0003,
258
    0x000F, 0x0002,
259 e5540b3f anonymous
    0x0081, 0x0021, 0x0009,
260 21aa398f Alex Beregszaszi
    0x0101, 0x0041, 0x0011,
261
    0x0100
262
  }
263
};
264
265
static const uint8_t vc9_ttmb_bits[3][16] = {
266
  {
267
     2,
268
     6,  7,  2,
269
     5,  5,  2,
270
     3,  5,
271
    10,  9,  9,
272
    12, 12, 11,
273
     9
274
  },
275
  {
276
    3,
277
    4, 4, 4,
278
    4, 4, 3,
279
    3, 2,
280
    7, 7, 6,
281
    6, 8, 7,
282
    8
283
  },
284
  {
285
     3,
286
     3, 4, 5,
287
     3, 3, 4,
288
     4, 2,
289 e5540b3f anonymous
    10, 8, 6,
290
    11, 9, 7,
291 21aa398f Alex Beregszaszi
    11
292
  }
293 115329f1 Diego Biurrun
};
294 21aa398f Alex Beregszaszi
295 7cc84d24 anonymous
/* TTBLK (Transform Type per Block) tables */
296
static const uint8_t vc9_ttblk_codes[3][8] = {
297
  {  0,  1,  3,  5, 16, 17, 18, 19},
298
  {  3,  0,  1,  2,  3,  5,  8,  9},
299
  {  1,  0,  1,  4,  6,  7, 10, 11}
300
};
301
static const uint8_t vc9_ttblk_bits[3][8] = {
302
  {  2,  2,  2,  3,  5,  5,  5,  5},
303
  {  2,  3,  3,  3,  3,  3,  4,  4},
304
  {  2,  3,  3,  3,  3,  3,  4,  4}
305
};
306
307
/* SUBBLKPAT tables, p93-94, reordered */
308
static const uint8_t vc9_subblkpat_codes[3][15] = {
309
  { 14, 12,  7, 11,  9, 26,  2, 10, 27,  8,  0,  6,  1, 15,  1},
310
  { 14,  0,  8, 15, 10,  4, 23, 13,  5,  9, 25,  3, 24, 22,  1},
311
  {  5,  6,  2,  2,  8,  0, 28,  3,  1,  3, 29,  1, 19, 18, 15}
312
};
313
static const uint8_t vc9_subblkpat_bits[3][15] = {
314
  {  5,  5,  5,  5,  5,  6,  4,  5,  6,  5,  4,  5,  4,  5,  1},
315
  {  4,  3,  4,  4,  4,  5,  5,  4,  5,  4,  5,  4,  5,  5,  2},
316
  {  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4}
317
};
318 21aa398f Alex Beregszaszi
319
/* MV differential tables, p265 */
320
static const uint16_t vc9_mv_diff_codes[4][73] = {
321
  {
322
       0,    2,    3,    8,  576,    3,    2,    6,
323
       5,  577,  578,    7,    8,    9,   40,   19,
324
      37,   82,   21,   22,   23,  579,  580,  166,
325
      96,  167,   49,  194,  195,  581,  582,  583,
326
     292,  293,  294,   13,    2,    7,   24,   50,
327
     102,  295,   13,    7,    8,   18,   50,  103,
328
      38,   20,   21,   22,   39,  204,  103,   23,
329
      24,   25,  104,  410,  105,  106,  107,  108,
330
     109,  220,  411,  442,  222,  443,  446,  447,
331
       7 /* 73 elements */
332
  },
333
  {
334
       0,    4,    5,    3,    4,    3,    4,    5,
335
      20,    6,   21,   44,   45,   46, 3008,   95,
336
     112,  113,   57, 3009, 3010,  116,  117, 3011,
337
     118, 3012, 3013, 3014, 3015, 3016, 3017, 3018,
338
    3019, 3020, 3021, 3022,    1,    4,   15,  160,
339
     161,   41,    6,   11,   42,  162,   43,  119,
340
      56,   57,   58,  163,  236,  237, 3023,  119,
341
     120,  242,  122,  486, 1512,  487,  246,  494,
342
    1513,  495, 1514, 1515, 1516, 1517, 1518, 1519,
343
      31 /* 73 elements */
344
  },
345
  {
346
       0,  512,  513,  514,  515,    2,    3,  258,
347
     259,  260,  261,  262,  263,  264,  265,  266,
348
     267,  268,  269,  270,  271,  272,  273,  274,
349
     275,  276,  277,  278,  279,  280,  281,  282,
350
     283,  284,  285,  286,    1,    5,  287,  288,
351
     289,  290,    6,    7,  291,  292,  293,  294,
352
     295,  296,  297,  298,  299,  300,  301,  302,
353
     303,  304,  305,  306,  307,  308,  309,  310,
354
     311,  312,  313,  314,  315,  316,  317,  318,
355
     319 /* 73 elements */
356
  },
357
  {
358
       0,    1,    1,    2,    3,    4,    1,    5,
359
       4,    3,    5,    8,    6,    9,   10,   11,
360
      12,    7,  104,   14,  105,    4,   10,   15,
361
      11,    6,   14,    8,  106,  107,  108,   15,
362
     109,    9,   55,   10,    1,    2,    1,    2,
363
       3,   12,    6,    2,    6,    7,   28,    7,
364
      15,    8,    5,   18,   29,  152,   77,   24,
365
      25,   26,   39,  108,   13,  109,   55,   56,
366
      57,  116,   11,  153,  234,  235,  118,  119,
367
      15 /* 73 elements */
368
  }
369
};
370
static const uint8_t vc9_mv_diff_bits[4][73] = {
371
  {
372
     6,  7,  7,  8, 14,  6,  5,  6,  7, 14, 14,  6,  6,  6,  8,  9,
373
    10,  9,  7,  7,  7, 14, 14, 10,  9, 10,  8, 10, 10, 14, 14, 14,
374
    13, 13, 13,  6,  3,  5,  6,  8,  9, 13,  5,  4,  4,  5,  7,  9,
375
     6,  5,  5,  5,  6,  9,  8,  5,  5,  5,  7, 10,  7,  7,  7,  7,
376
     7,  8, 10,  9,  8,  9,  9,  9,  3 /* 73 elements */
377
  },
378
  {
379
     5,  7,  7,  6,  6,  5,  5,  6,  7,  5,  7,  8,  8,  8, 14,  9,
380
     9,  9,  8, 14, 14,  9,  9, 14,  9, 14, 14, 14, 14, 14, 14, 14,
381
    14, 14, 14, 14,  2,  3,  6,  8,  8,  6,  3,  4,  6,  8,  6,  9,
382
     6,  6,  6,  8,  8,  8, 14,  7,  7,  8,  7,  9, 13,  9,  8,  9,
383
    13,  9, 13, 13, 13, 13, 13, 13,  5 /* 73 elements */
384 115329f1 Diego Biurrun
385 21aa398f Alex Beregszaszi
  },
386
  {
387
     3, 12, 12, 12, 12,  3,  4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
388
    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
389
    11, 11, 11, 11,  1,  5, 11, 11, 11, 11,  4,  4, 11, 11, 11, 11,
390
    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
391
    11, 11, 11, 11, 11, 11, 11, 11, 11 /* 73 elements */
392
  },
393
  {
394
    15, 11, 15, 15, 15, 15, 12, 15, 12, 11, 12, 12, 15, 12, 12, 12,
395
    12, 15, 15, 12, 15, 10, 11, 12, 11, 10, 11, 10, 15, 15, 15, 11,
396
    15, 10, 14, 10,  4,  4,  5,  7,  8,  9,  5,  3,  4,  5,  6,  8,
397
     5,  4,  3,  5,  6,  8,  7,  5,  5,  5,  6,  7,  9,  7,  6,  6,
398
     6,  7, 10,  8,  8,  8,  7,  7,  4 /* 73 elements */
399
  }
400
};
401
402 0c040aac anonymous
/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
403 e5540b3f anonymous
404
/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
405 21aa398f Alex Beregszaszi
406
#endif /* VC9DATA_H */