diff vc1data.h @ 3360:2c4ddf5b9217 libavcodec

VC-1 decoder with I-frames support and partial P-frames decoding
author kostya
date Tue, 27 Jun 2006 03:11:51 +0000
parents 87187ebe2c28
children 20938be7b67b
line wrap: on
line diff
--- a/vc1data.h	Tue Jun 27 02:55:54 2006 +0000
+++ b/vc1data.h	Tue Jun 27 03:11:51 2006 +0000
@@ -1,6 +1,6 @@
 /**
  * @file vc1data.h
- * VC1 tables.
+ * VC-1 tables.
  */
 
 #ifndef VC1DATA_H
@@ -167,10 +167,65 @@
 };
 
 const uint8_t wmv3_dc_scale_table[32]={
-    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
+    0, 2, 4, 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
 };
 
 /* P-Picture CBPCY VLC tables */
+#if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
+static const uint16_t vc1_cbpcy_p_codes[4][64] = {
+  {
+      0,   6,  15,  13,  13,  11,   3,  13,   5,   8,  49,  10,  12, 114, 102, 119,
+      1,  54,  96,   8,  10, 111,   5,  15,  12,  10,   2,  12,  13, 115,  53,  63,
+      1,   7,   1,   7,  14,  12,   4,  14,   1,   9,  97,  11,   7,  58,  52,  62,
+      4, 103,   1,   9,  11,  56, 101, 118,   4, 110, 100,  30,   2,   5,   4,   3
+  },
+  {
+      0,   9,   1,  18,   5,  14, 237,  26,   3, 121,   3,  22,  13,  16,   6,  30,
+      2,  10,   1,  20,  12, 241,   5,  28,  16,  12,   3,  24,  28, 124, 239, 247,
+      1, 240,   1,  19,  18,  15,   4,  27,   1, 122,   2,  23,   1,  17,   7,  31,
+      1,  11,   2,  21,  19, 246, 238,  29,  17,  13, 236,  25,  58,  63,   8, 125
+  },
+  {
+      0, 201,  25, 231,   5, 221,   1,   3,   2, 414,   2, 241,  16, 225, 195, 492,
+      2, 412,   1, 240,   7, 224,  98, 245,   1, 220,  96,   5,   9, 230, 101, 247,
+      1, 102,   1, 415,  24,   3,   2, 244,   3,  54,   3, 484,  17, 114, 200, 493,
+      3, 413,   1,   4,  13, 113,  99, 485,   4, 111, 194, 243,   5,  29,  26,  31
+  },
+  {
+      0,  28,  12,  44,   3,  36,  20,  52,   2,  32,  16,  48,   8,  40,  24,  28,
+      1,  30,  14,  46,   6,  38,  22,  54,   3,  34,  18,  50,  10,  42,  26,  30,
+      1,  29,  13,  45,   5,  37,  21,  53,   2,  33,  17,  49,   9,  41,  25,  29,
+      1,  31,  15,  47,   7,  39,  23,  55,   4,  35,  19,  51,  11,  43,  27,  31
+   }
+};
+
+static const uint8_t vc1_cbpcy_p_bits[4][64] = {
+  {
+    13,  13,   7,  13,   7,  13,  13,  12,   6,  13,   7,  12,   6,   8,   8,   8,
+     5,   7,   8,  12,   6,   8,  13,  12,   7,  13,  13,  12,   6,   8,   7,   7,
+     6,  13,   8,  12,   7,  13,  13,  12,   7,  13,   8,  12,   5,   7,   7,   7,
+     6,   8,  13,  12,   6,   7,   8,   8,   5,   8,   8,   6,   3,   3,   3,   2
+  },
+  {
+    14,  13,   8,  13,   3,  13,   8,  13,   3,   7,   8,  13,   4,  13,  13,  13,
+     3,  13,  13,  13,   4,   8,  13,  13,   5,  13,  13,  13,   5,   7,   8,   8,
+     3,   8,  14,  13,   5,  13,  13,  13,   4,   7,  13,  13,   6,  13,  13,  13,
+     5,  13,   8,  13,   5,   8,   8,  13,   5,  13,   8,  13,   6,   6,  13,   7
+  },
+  {
+    13,   8,   6,   8,   4,   8,  13,  12,   4,   9,   8,   8,   5,   8,   8,   9,
+     5,   9,  10,   8,   4,   8,   7,   8,   6,   8,   7,  13,   4,   8,   7,   8,
+     5,   7,   8,   9,   6,  13,  13,   8,   4,   6,   8,   9,   5,   7,   8,   9,
+     5,   9,   9,  13,   5,   7,   7,   9,   4,   7,   8,   8,   3,   5,   5,   5
+  },
+  {
+     9,   9,   9,   9,   2,   9,   9,   9,   2,   9,   9,   9,   9,   9,   9,   8,
+     3,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   8,
+     2,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   8,
+     9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   8
+  }
+};
+#else
 static const uint16_t vc1_cbpcy_p_codes[4][64] = {
   {
       0,   1,   1,   4,   5,   1,  12,   4,  13,  14,  10,  11,  12,   7,  13,   2,
@@ -223,6 +278,7 @@
      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8
   }
 };
+#endif
 
 /* MacroBlock Transform Type: 7.1.3.11, p89
  * 8x8:B
@@ -402,5 +458,153 @@
 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
 
 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
+static const int8_t vc1_normal_zz[64] = {
+       0,     8,     1,     2,     9,    16,    24,    17,
+      10,     3,     4,    11,    18,    25,    32,    40,
+      33,    48,    26,    19,    12,     5,     6,    13,
+      20,    27,    34,    41,    56,    49,    57,    42,
+      35,    28,    21,    14,     7,    15,    22,    29,
+      36,    43,    50,    58,    51,    59,    44,    37,
+      30,    23,    31,    38,    45,    52,    60,    53,
+      61,    46,    39,    47,    54,    62,    55,    63
+};
 
+static const int8_t vc1_horizontal_zz [64] = /* Table 227 */
+{
+       0,     1,     8,     2,     3,     9,    16,    24,
+      17,    10,     4,     5,    11,    18,    25,    32,
+      40,    48,    33,    26,    19,    12,     6,     7,
+      13,    20,    27,    34,    41,    56,    49,    57,
+      42,    35,    28,    21,    14,    15,    22,    29,
+      36,    43,    50,    58,    51,    44,    37,    30,
+      23,    31,    38,    45,    52,    59,    60,    53,
+      46,    39,    47,    54,    61,    62,    55,    63
+};
+
+static const int8_t vc1_vertical_zz [64] = /* Table 228 */
+{
+       0,     8,    16,     1,    24,    32,    40,     9,
+       2,     3,    10,    17,    25,    48,    56,    41,
+      33,    26,    18,    11,     4,     5,    12,    19,
+      27,    34,    49,    57,    50,    42,    35,    28,
+      20,    13,     6,     7,    14,    21,    29,    36,
+      43,    51,    58,    59,    52,    44,    37,    30,
+      22,    15,    23,    31,    38,    45,    60,    53,
+      46,    39,    47,    54,    61,    62,    55,    63
+};
+
+static const int8_t vc1_simple_progressive_8x8_zz [64] =
+/* Table 229 */
+{
+       0,     8,     1,     2,     9,    16,    24,    17,
+      10,     3,     4,    11,    18,    25,    32,    40,
+      48,    56,    41,    33,    26,    19,    12,     5,
+       6,    13,    20,    27,    34,    49,    57,    58,
+      50,    42,    35,    28,    21,    14,     7,    15,
+      22,    29,    36,    43,    51,    59,    60,    52,
+      44,    37,    30,    23,    31,    38,    45,    53,
+      61,    62,    54,    46,    39,    47,    55,    63
+};
+
+static const int8_t vc1_simple_progressive_8x4_zz [32] = /* Table 230 */
+{
+       0,     1,     2,     8,     3,     9,    10,    16,
+       4,    11,    17,    24,    18,    12,     5,    19,
+      25,    13,    20,    26,    27,     6,    21,    28,
+      14,    22,    29,     7,    30,    15,    23,    31
+};
+
+static const int8_t vc1_simple_progressive_4x8_zz [32] = /* Table 231 */
+{
+       0,     8,     1,    16,
+       9,    24,    17,     2,
+      32,    10,    25,    40,
+      18,    48,    33,    26,
+      56,    41,    34,     3,
+      49,    57,    11,    42,
+      19,    50,    27,    58,
+      35,    43,    51,    59
+};
+
+/* Table 232 */
+static const int8_t vc1_simple_progressive_4x4_zz [16] =
+{
+       0,     8,    16,     1,
+       9,    24,    17,     2,
+      10,    18,    25,     3,
+      11,    26,    19,    27
+};
+
+static const int8_t vc1_adv_progressive_8x4_zz [32] = /* Table 233 */
+{
+       0,     8,     1,    16,     2,     9,    10,     3,
+      24,    17,     4,    11,    18,    12,     5,    19,
+      25,    13,    20,    26,    27,     6,    21,    28,
+      14,    22,    29,     7,    30,    15,    23,    31
+};
+
+static const int8_t vc1_adv_progressive_4x8_zz [32] = /* Table 234 */
+{
+       0,     1,     8,     2,
+       9,    16,    17,    24,
+      10,    32,    25,    18,
+      40,     3,    33,    26,
+      48,    11,    56,    41,
+      34,    49,    57,    42,
+      19,    50,    27,    58,
+      35,    43,    51,    59
+};
+
+static const int8_t vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */
+{
+       0,     8,     1,    16,    24,     9,     2,    32,
+      40,    48,    56,    17,    10,     3,    25,    18,
+      11,     4,    33,    41,    49,    57,    26,    34,
+      42,    50,    58,    19,    12,     5,    27,    20,
+      13,     6,    35,    28,    21,    14,     7,    15,
+      22,    29,    36,    43,    51,    59,    60,    52,
+      44,    37,    30,    23,    31,    38,    45,    53,
+      61,    62,    54,    46,    39,    47,    55,    63
+};
+
+static const int8_t vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */
+{
+       0,     8,    16,    24,     1,     9,     2,    17,
+      25,    10,     3,    18,    26,     4,    11,    19,
+      12,     5,    13,    20,    27,     6,    21,    28,
+      14,    22,    29,     7,    30,    15,    23,    31
+};
+
+static const int8_t vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */
+{
+       0,     1,     2,     8,
+      16,     9,    24,    17,
+      10,     3,    32,    40,
+      48,    56,    25,    18,
+      33,    26,    41,    34,
+      49,    57,    11,    42,
+      19,    50,    27,    58,
+      35,    43,    51,    59
+};
+
+static const int8_t vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */
+{
+       0,     8,    16,    24,
+       1,     9,    17,     2,
+      25,    10,    18,     3,
+      26,    11,    19,    27
+};
+
+
+/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
+static const int32_t vc1_dqscale[63] = {
+0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
+    0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000,
+    0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB,
+    0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000,
+    0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A,
+    0x18FA, 0x1862, 0x17D0, 0x1746, 0x16C1, 0x1643, 0x15CA, 0x1555,
+    0x14E6, 0x147B, 0x1414, 0x13B1, 0x1352, 0x12F7, 0x129E, 0x1249,
+    0x11F7, 0x11A8, 0x115B, 0x1111, 0x10C9, 0x1084, 0x1000
+};
 #endif /* VC1DATA_H */