diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 23a0743813..c2a440d2e7 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -1376,18 +1376,19 @@ av_cold int ff_vc1_init_common(VC1Context *v)
         INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
                         ff_vc1_norm2_bits, 1, 1,
                         ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS);
-        INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
-                        ff_vc1_norm6_bits, 1, 1,
-                        ff_vc1_norm6_codes, 2, 2, 556);
+        INIT_VLC_STATIC_FROM_LENGTHS(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 77,
+                                     &ff_vc1_norm6_tab[0][1], 2,
+                                     &ff_vc1_norm6_tab[0][0], 2, 1, 0, 0, 556);
         INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
                         ff_vc1_imode_bits, 1, 1,
                         ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS);
         for (i = 0; i < 3; i++) {
             ff_vc1_ttmb_vlc[i].table           = &vlc_table[vlc_offs[i * 3 + 0]];
             ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0];
-            init_vlc(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
-                     ff_vc1_ttmb_bits[i], 1, 1,
-                     ff_vc1_ttmb_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
+            ff_init_vlc_from_lengths(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
+                                     &ff_vc1_ttmb_tabs[i][0][1], 2,
+                                     &ff_vc1_ttmb_tabs[i][0][0], 2, 1,
+                                     0, INIT_VLC_USE_NEW_STATIC, NULL);
             ff_vc1_ttblk_vlc[i].table           = &vlc_table[vlc_offs[i * 3 + 1]];
             ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1];
             ff_init_vlc_from_lengths(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8,
@@ -1409,9 +1410,10 @@ av_cold int ff_vc1_init_common(VC1Context *v)
                      ff_vc1_4mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
             ff_vc1_cbpcy_p_vlc[i].table           = &vlc_table[vlc_offs[i * 3 + 10]];
             ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i * 3 + 11] - vlc_offs[i * 3 + 10];
-            init_vlc(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
-                     ff_vc1_cbpcy_p_bits[i], 1, 1,
-                     ff_vc1_cbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
+            ff_init_vlc_from_lengths(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
+                                     &ff_vc1_cbpcy_p_tabs[i][0][1], 2,
+                                     &ff_vc1_cbpcy_p_tabs[i][0][0], 2, 1,
+                                     0, INIT_VLC_USE_NEW_STATIC, NULL);
             ff_vc1_mv_diff_vlc[i].table           = &vlc_table[vlc_offs[i * 3 + 11]];
             ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i * 3 + 12] - vlc_offs[i * 3 + 11];
             ff_init_vlc_from_lengths(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73,
@@ -1470,9 +1472,10 @@ av_cold int ff_vc1_init_common(VC1Context *v)
             /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */
             ff_vc1_icbpcy_vlc[i].table           = &vlc_table[vlc_offs[i * 3 + 53]];
             ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53];
-            init_vlc(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63,
-                     ff_vc1_icbpcy_p_bits[i], 1, 1,
-                     ff_vc1_icbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
+            ff_init_vlc_from_lengths(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63,
+                                     &ff_vc1_icbpcy_p_tabs[i][0][1], 2,
+                                     &ff_vc1_icbpcy_p_tabs[i][0][0], 2, 1,
+                                     0, INIT_VLC_USE_NEW_STATIC, NULL);
             /* Initialize interlaced field picture MBMODE VLC tables */
             ff_vc1_if_mmv_mbmode_vlc[i].table           = &vlc_table[vlc_offs[i * 3 + 54]];
             ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54];
diff --git a/libavcodec/vc1data.c b/libavcodec/vc1data.c
index 682d7d174f..6c78895a38 100644
--- a/libavcodec/vc1data.c
+++ b/libavcodec/vc1data.c
@@ -184,18 +184,25 @@ const uint8_t ff_vc1_norm2_bits[4] = {
     1, 3, 3, 2
 };
 
-const uint16_t ff_vc1_norm6_codes[64] = {
-    0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
-    0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
-    0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
-    0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
-};
-
-const uint8_t ff_vc1_norm6_bits[64] = {
-    1,  4,  4,  8,  4,  8,  8, 10,  4,  8,  8, 10,  8, 10, 10, 13,
-    4,  8,  8, 10,  8, 10, 10, 13,  8, 10, 10, 13, 10, 13, 13,  9,
-    4,  8,  8, 10,  8, 10, 10, 13,  8, 10, 10, 13, 10, 13, 13,  9,
-    8, 10, 10, 13, 10, 13, 13,  9, 10, 13, 13,  9, 13,  9,  9,  6,
+/* The negative lengths in the following table correspond to
+ * open ends in the tree: It is incomplete. */
+const uint8_t ff_vc1_norm6_tab[77][2] = {
+    { 0x03,  8 }, { 0x05,  8 }, { 0x06,  8 }, { 0x09,  8 }, { 0x0A,  8 },
+    { 0x0C,  8 }, { 0x11,  8 }, { 0x12,  8 }, { 0x14,  8 }, { 0x18,  8 },
+    { 0x21,  8 }, { 0x22,  8 }, { 0x24,  8 }, { 0x28,  8 }, { 0x30,  8 },
+    {    0, -8 }, {    0, -9 }, {    0,-10 }, { 0x23, 10 }, {    0,-10 },
+    { 0x25, 10 }, { 0x26, 10 }, { 0x07, 10 }, {    0,-10 }, { 0x29, 10 },
+    { 0x2A, 10 }, { 0x0B, 10 }, { 0x2C, 10 }, { 0x0D, 10 }, { 0x0E, 10 },
+    {    0,-10 }, {    0,-10 }, { 0x31, 10 }, { 0x32, 10 }, { 0x13, 10 },
+    { 0x34, 10 }, { 0x15, 10 }, { 0x16, 10 }, {    0,-10 }, { 0x38, 10 },
+    { 0x19, 10 }, { 0x1A, 10 }, {    0,-10 }, { 0x1C, 10 }, {    0,-10 },
+    {    0, -9 }, { 0x3C, 13 }, { 0x3A, 13 }, { 0x39, 13 }, { 0x36, 13 },
+    { 0x35, 13 }, { 0x33, 13 }, { 0x2E, 13 }, { 0x2D, 13 }, { 0x2B, 13 },
+    { 0x27, 13 }, { 0x1E, 13 }, { 0x1D, 13 }, { 0x1B, 13 }, { 0x17, 13 },
+    { 0x0F, 13 }, {    0,-13 }, {    0, -9 }, { 0x3E,  9 }, { 0x3D,  9 },
+    { 0x3B,  9 }, { 0x37,  9 }, { 0x2F,  9 }, { 0x1F,  9 }, { 0x3F,  6 },
+    { 0x01,  4 }, { 0x02,  4 }, { 0x04,  4 }, { 0x08,  4 }, { 0x10,  4 },
+    { 0x20,  4 }, { 0x00,  1 },
 };
 
 /* 4MV Block pattern VLC tables */
@@ -694,261 +701,218 @@ const uint8_t ff_wmv3_dc_scale_table[32] = {
 
 /* P-Picture CBPCY VLC tables */
 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
-const uint16_t ff_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
-   }
-};
-
-const uint8_t ff_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
-  }
+const uint8_t ff_vc1_cbpcy_p_tabs[4][64][2] = {
+    { /* Table 169 */
+        { 0x00, 13 }, { 0x32, 13 }, { 0x1A, 13 }, { 0x06, 13 }, { 0x26, 13 },
+        { 0x16, 13 }, { 0x01, 13 }, { 0x21, 13 }, { 0x09, 13 }, { 0x29, 13 },
+        { 0x19, 13 }, { 0x05, 13 }, { 0x25, 13 }, { 0x03, 13 }, { 0x23, 12 },
+        { 0x13, 12 }, { 0x33, 12 }, { 0x0B, 12 }, { 0x2B, 12 }, { 0x1B, 12 },
+        { 0x07, 12 }, { 0x27, 12 }, { 0x17, 12 }, { 0x22,  8 }, { 0x28,  7 },
+        { 0x20,  6 }, { 0x10,  5 }, { 0x30,  6 }, { 0x08,  6 }, { 0x18,  7 },
+        { 0x04,  7 }, { 0x24,  7 }, { 0x02,  7 }, { 0x38,  5 }, { 0x14,  6 },
+        { 0x34,  6 }, { 0x0C,  6 }, { 0x1C,  6 }, { 0x2C,  5 }, { 0x3C,  3 },
+        { 0x12,  8 }, { 0x2A,  8 }, { 0x0A,  7 }, { 0x3A,  8 }, { 0x36,  8 },
+        { 0x0E,  8 }, { 0x31,  8 }, { 0x2E,  7 }, { 0x1E,  7 }, { 0x11,  7 },
+        { 0x39,  8 }, { 0x15,  8 }, { 0x35,  7 }, { 0x0D,  8 }, { 0x1D,  8 },
+        { 0x2D,  7 }, { 0x37,  8 }, { 0x0F,  8 }, { 0x3B,  6 }, { 0x2F,  7 },
+        { 0x1F,  7 }, { 0x3E,  3 }, { 0x3D,  3 }, { 0x3F,  2 },
+    },
+    { /* Table 170 */
+        { 0x00, 14 }, { 0x22, 14 }, { 0x12, 13 }, { 0x2A, 13 }, { 0x1A, 13 },
+        { 0x26, 13 }, { 0x16, 13 }, { 0x0E, 13 }, { 0x2E, 13 }, { 0x3E, 13 },
+        { 0x01, 13 }, { 0x11, 13 }, { 0x31, 13 }, { 0x19, 13 }, { 0x39, 13 },
+        { 0x05, 13 }, { 0x25, 13 }, { 0x0D, 13 }, { 0x2D, 13 }, { 0x03, 13 },
+        { 0x23, 13 }, { 0x13, 13 }, { 0x33, 13 }, { 0x0B, 13 }, { 0x2B, 13 },
+        { 0x1B, 13 }, { 0x3B, 13 }, { 0x07, 13 }, { 0x27, 13 }, { 0x17, 13 },
+        { 0x37, 13 }, { 0x0F, 13 }, { 0x2F, 13 }, { 0x02,  8 }, { 0x32,  8 },
+        { 0x0A,  8 }, { 0x2C,  6 }, { 0x30,  5 }, { 0x28,  4 }, { 0x20,  3 },
+        { 0x10,  3 }, { 0x08,  3 }, { 0x18,  5 }, { 0x38,  5 }, { 0x24,  5 },
+        { 0x34,  5 }, { 0x04,  3 }, { 0x14,  4 }, { 0x0C,  4 }, { 0x1C,  5 },
+        { 0x3C,  6 }, { 0x3A,  8 }, { 0x06,  8 }, { 0x36,  8 }, { 0x1E,  8 },
+        { 0x21,  8 }, { 0x15,  8 }, { 0x09,  7 }, { 0x29,  7 }, { 0x35,  8 },
+        { 0x1F,  8 }, { 0x1D,  7 }, { 0x3F,  7 }, { 0x3D,  6 },
+    },
+    { /* Table 171 */
+        { 0x00, 13 }, { 0x06, 13 }, { 0x26, 13 }, { 0x25, 13 }, { 0x33, 13 },
+        { 0x1B, 13 }, { 0x07, 12 }, { 0x12, 10 }, { 0x32,  9 }, { 0x22,  8 },
+        { 0x0A,  8 }, { 0x2A,  8 }, { 0x18,  6 }, { 0x20,  5 }, { 0x10,  5 },
+        { 0x30,  5 }, { 0x08,  4 }, { 0x28,  4 }, { 0x38,  4 }, { 0x04,  4 },
+        { 0x24,  6 }, { 0x02,  6 }, { 0x34,  5 }, { 0x14,  4 }, { 0x0C,  5 },
+        { 0x2C,  5 }, { 0x1C,  4 }, { 0x3C,  3 }, { 0x1A,  7 }, { 0x3A,  8 },
+        { 0x0E,  8 }, { 0x16,  7 }, { 0x36,  7 }, { 0x2E,  8 }, { 0x01,  8 },
+        { 0x1E,  7 }, { 0x21,  7 }, { 0x11,  9 }, { 0x31,  9 }, { 0x09,  9 },
+        { 0x23,  9 }, { 0x3E,  5 }, { 0x29,  6 }, { 0x19,  8 }, { 0x05,  8 },
+        { 0x39,  7 }, { 0x15,  8 }, { 0x0D,  8 }, { 0x35,  7 }, { 0x2D,  7 },
+        { 0x1D,  8 }, { 0x03,  8 }, { 0x3D,  5 }, { 0x13,  8 }, { 0x0B,  8 },
+        { 0x2B,  9 }, { 0x37,  9 }, { 0x3B,  8 }, { 0x27,  8 }, { 0x17,  8 },
+        { 0x0F,  9 }, { 0x2F,  9 }, { 0x1F,  8 }, { 0x3F,  5 },
+    },
+    { /* Table 172 */
+        { 0x00,  9 }, { 0x30,  9 }, { 0x28,  9 }, { 0x18,  9 }, { 0x38,  9 },
+        { 0x24,  9 }, { 0x14,  9 }, { 0x34,  9 }, { 0x0C,  9 }, { 0x2C,  9 },
+        { 0x1C,  9 }, { 0x3C,  9 }, { 0x02,  9 }, { 0x22,  9 }, { 0x12,  9 },
+        { 0x32,  9 }, { 0x0A,  9 }, { 0x2A,  9 }, { 0x1A,  9 }, { 0x3A,  9 },
+        { 0x06,  9 }, { 0x26,  9 }, { 0x16,  9 }, { 0x36,  9 }, { 0x0E,  9 },
+        { 0x2E,  9 }, { 0x1E,  9 }, { 0x3E,  9 }, { 0x01,  9 }, { 0x21,  9 },
+        { 0x11,  9 }, { 0x31,  9 }, { 0x09,  9 }, { 0x29,  9 }, { 0x19,  9 },
+        { 0x39,  9 }, { 0x05,  9 }, { 0x25,  9 }, { 0x15,  9 }, { 0x35,  9 },
+        { 0x0D,  9 }, { 0x2D,  9 }, { 0x1D,  9 }, { 0x3D,  9 }, { 0x03,  9 },
+        { 0x23,  9 }, { 0x13,  9 }, { 0x33,  9 }, { 0x0B,  9 }, { 0x2B,  9 },
+        { 0x1B,  9 }, { 0x3B,  9 }, { 0x07,  9 }, { 0x27,  9 }, { 0x17,  9 },
+        { 0x37,  9 }, { 0x0F,  8 }, { 0x2F,  8 }, { 0x1F,  8 }, { 0x3F,  8 },
+        { 0x10,  3 }, { 0x20,  2 }, { 0x08,  2 }, { 0x04,  2 },
+    },
 };
 
 /* Interlaced CBPCY VLC tables (Table 124 - Table 131) */
-const uint16_t ff_vc1_icbpcy_p_codes[8][63] = {
-  {
-    0x2F1A, 0x2F1B, 0x178C, 0x0090, 0x02A8, 0x02A9, 0x0BC7, 0x0091,
-    0x02AA, 0x02AB, 0x05E0, 0x004A, 0x0096, 0x0097, 0x00BD, 0x0092,
-    0x02AC, 0x02AD, 0x05E1, 0x0098, 0x0132, 0x0133, 0x0179, 0x0134,
-    0x026A, 0x026B, 0x02FC, 0x004E, 0x0040, 0x0041, 0x002B, 0x0093,
-    0x02AE, 0x02AF, 0x05E2, 0x0136, 0x026E, 0x026F, 0x02FD, 0x009E,
-    0x013E, 0x013F, 0x017F, 0x0050, 0x0042, 0x0043, 0x002C, 0x0051,
-    0x00A4, 0x00A5, 0x00BE, 0x0053, 0x0044, 0x0045, 0x002D, 0x0054,
-    0x0046, 0x0047, 0x002E, 0x0003, 0x0000, 0x0001, 0x0001
-  },
-  {
-    0x0041, 0x0042, 0x0100, 0x0043, 0x0088, 0x0089, 0x0101, 0x0045,
-    0x008C, 0x008D, 0x0102, 0x0010, 0x0022, 0x0023, 0x0024, 0x0047,
-    0x0010, 0x0011, 0x0103, 0x0025, 0x0058, 0x0059, 0x005A, 0x005B,
-    0x005A, 0x005B, 0x005C, 0x000C, 0x0030, 0x0031, 0x0019, 0x0009,
-    0x0014, 0x0015, 0x002C, 0x005C, 0x005D, 0x005E, 0x005F, 0x0026,
-    0x005D, 0x005E, 0x005F, 0x000D, 0x0034, 0x0035, 0x001B, 0x0014,
-    0x0027, 0x002A, 0x002B, 0x000E, 0x0038, 0x0039, 0x001D, 0x000F,
-    0x003C, 0x003D, 0x001F, 0x0005, 0x0009, 0x0000, 0x0003
-  },
-  {
-    0x0032, 0x0033, 0x001A, 0x0026, 0x00E4, 0x00E5, 0x01E6, 0x0027,
-    0x00E6, 0x00E7, 0x01E7, 0x000E, 0x0063, 0x006C, 0x0077, 0x0028,
-    0x00E8, 0x00E9, 0x01E8, 0x007B, 0x00DA, 0x00DB, 0x00EC, 0x00F5,
-    0x01B8, 0x01B9, 0x01DA, 0x0021, 0x004B, 0x0054, 0x002B, 0x0029,
-    0x00EA, 0x00EB, 0x01E9, 0x004A, 0x01BA, 0x01BB, 0x01DB, 0x0020,
-    0x00DE, 0x00DF, 0x00F2, 0x0022, 0x0055, 0x0058, 0x002D, 0x000F,
-    0x0070, 0x0071, 0x0078, 0x0023, 0x0059, 0x005C, 0x002F, 0x0024,
-    0x005D, 0x0062, 0x0030, 0x0002, 0x001F, 0x0006, 0x0000
-  },
-  {
-    0x0028, 0x0029, 0x009D, 0x0000, 0x01EA, 0x01EB, 0x01EC, 0x0001,
-    0x01ED, 0x01EE, 0x01EF, 0x0005, 0x00F0, 0x00F1, 0x003B, 0x0002,
-    0x01F0, 0x01F1, 0x01F2, 0x003F, 0x015C, 0x015D, 0x0099, 0x0010,
-    0x03D0, 0x03D1, 0x0130, 0x000F, 0x009E, 0x009F, 0x00FB, 0x0003,
-    0x01F3, 0x01F4, 0x01F5, 0x0011, 0x03D2, 0x03D3, 0x0131, 0x0009,
-    0x015E, 0x015F, 0x009C, 0x0010, 0x00A8, 0x00A9, 0x0038, 0x0006,
-    0x00F2, 0x00F3, 0x004D, 0x0011, 0x00AA, 0x00AB, 0x0039, 0x0012,
-    0x00AC, 0x00AD, 0x003A, 0x0006, 0x0016, 0x0017, 0x000E
-  },
-  {
-    0x003C, 0x003D, 0x001F, 0x000A, 0x0061, 0x0062, 0x0002, 0x000B,
-    0x0063, 0x0064, 0x0003, 0x0007, 0x0003, 0x0004, 0x000B, 0x000C,
-    0x0065, 0x0066, 0x0004, 0x0012, 0x000A, 0x000B, 0x0014, 0x001B,
-    0x0018, 0x0019, 0x0034, 0x002C, 0x0067, 0x0068, 0x0035, 0x000D,
-    0x0069, 0x006C, 0x0005, 0x0060, 0x001A, 0x001B, 0x0035, 0x0013,
-    0x000E, 0x000F, 0x0015, 0x002D, 0x006D, 0x006E, 0x0038, 0x0008,
-    0x0008, 0x0009, 0x000C, 0x002E, 0x006F, 0x0072, 0x003A, 0x002F,
-    0x0073, 0x0000, 0x003B, 0x0007, 0x0014, 0x0015, 0x0004
-  },
-  {
-    0x0038, 0x0039, 0x009D, 0x000A, 0x0091, 0x0092, 0x0093, 0x000B,
-    0x0094, 0x0095, 0x0096, 0x0003, 0x00EE, 0x00EF, 0x0036, 0x000C,
-    0x0097, 0x0098, 0x0099, 0x0008, 0x01E4, 0x01E5, 0x006A, 0x0018,
-    0x03CC, 0x03CD, 0x00D6, 0x000E, 0x009E, 0x009F, 0x00F5, 0x000D,
-    0x009A, 0x009B, 0x009C, 0x0019, 0x03CE, 0x03CF, 0x00D7, 0x0009,
-    0x01E8, 0x01E9, 0x0090, 0x000F, 0x00E8, 0x00E9, 0x00F6, 0x0005,
-    0x00F0, 0x00F1, 0x0037, 0x0010, 0x00EA, 0x00EB, 0x00F7, 0x0011,
-    0x00EC, 0x00ED, 0x0034, 0x0000, 0x003E, 0x003F, 0x0002
-  },
-  {
-    0x003C, 0x003D, 0x01CF, 0x0000, 0x00BF, 0x00E0, 0x01FC, 0x0001,
-    0x00E1, 0x00E2, 0x01FD, 0x0009, 0x01F1, 0x01F2, 0x01F3, 0x0002,
-    0x00E3, 0x00E4, 0x01FE, 0x0011, 0x03EE, 0x03EF, 0x03F0, 0x0021,
-    0x07E2, 0x07E3, 0x07E4, 0x0018, 0x03F7, 0x03FE, 0x03FF, 0x0003,
-    0x00E5, 0x00E6, 0x0080, 0x002E, 0x07E5, 0x07E6, 0x07E7, 0x0016,
-    0x03F4, 0x03F5, 0x03F6, 0x0019, 0x0102, 0x0103, 0x0104, 0x000A,
-    0x01F4, 0x01F5, 0x01F6, 0x001A, 0x0105, 0x0106, 0x0107, 0x001B,
-    0x0178, 0x0179, 0x01CE, 0x001D, 0x00BD, 0x00BE, 0x01F0
-  },
-  {
-    0x0003, 0x0004, 0x01B6, 0x0004, 0x002E, 0x002F, 0x000E, 0x0005,
-    0x0030, 0x0031, 0x000F, 0x0003, 0x000A, 0x000B, 0x0014, 0x0006,
-    0x0032, 0x0033, 0x0010, 0x0005, 0x0030, 0x0031, 0x0032, 0x0009,
-    0x0066, 0x0067, 0x0068, 0x001D, 0x01B7, 0x01B8, 0x01B9, 0x0007,
-    0x0034, 0x0035, 0x0011, 0x0016, 0x0069, 0x006A, 0x006B, 0x000A,
-    0x0036, 0x0037, 0x00D8, 0x001E, 0x01BA, 0x01BB, 0x01BC, 0x0004,
-    0x0015, 0x0016, 0x0017, 0x001F, 0x01BD, 0x01BE, 0x01BF, 0x0000,
-    0x0010, 0x0011, 0x0012, 0x001C, 0x00D9, 0x00DA, 0x0013
-  }
-};
-
-const uint8_t ff_vc1_icbpcy_p_bits[8][63] = {
-  {
-    15, 15, 14,  9, 11, 11, 13,  9, 11, 11, 12,  8,  9,  9,  9,  9,
-    11, 11, 12,  9, 10, 10, 10, 10, 11, 11, 11,  8,  8,  8,  7,  9,
-    11, 11, 12, 10, 11, 11, 11,  9, 10, 10, 10,  8,  8,  8,  7,  8,
-     9,  9,  9,  8,  8,  8,  7,  8,  8,  8,  7,  3,  3,  3,  1
-  },
-  {
-     7,  7,  9,  7,  8,  8,  9,  7,  8,  8,  9,  6,  7,  7,  7,  7,
-     7,  7,  9,  7,  8,  8,  8,  8,  9,  9,  9,  6,  7,  7,  6,  6,
-     7,  7,  8,  8,  9,  9,  9,  7,  8,  8,  8,  6,  7,  7,  6,  6,
-     7,  7,  7,  6,  7,  7,  6,  6,  7,  7,  6,  3,  4,  3,  2
-  },
-  {
-     6,  6,  5,  6,  8,  8,  9,  6,  8,  8,  9,  5,  7,  7,  7,  6,
-     8,  8,  9,  7,  8,  8,  8,  8,  9,  9,  9,  6,  7,  7,  6,  6,
-     8,  8,  9,  7,  9,  9,  9,  6,  8,  8,  8,  6,  7,  7,  6,  5,
-     7,  7,  7,  6,  7,  7,  6,  6,  7,  7,  6,  3,  5,  4,  2
-  },
-  {
-     6,  6,  8,  4,  9,  9,  9,  4,  9,  9,  9,  4,  8,  8,  7,  4,
-     9,  9,  9,  6,  9,  9,  8,  6, 10, 10,  9,  5,  8,  8,  8,  4,
-     9,  9,  9,  6, 10, 10,  9,  5,  9,  9,  8,  5,  8,  8,  7,  4,
-     8,  8,  7,  5,  8,  8,  7,  5,  8,  8,  7,  3,  5,  5,  4
-  },
-  {
-     6,  6,  5,  5,  7,  7,  7,  5,  7,  7,  7,  5,  6,  6,  6,  5,
-     7,  7,  7,  6,  7,  7,  7,  7,  8,  8,  8,  6,  7,  7,  6,  5,
-     7,  7,  7,  7,  8,  8,  8,  6,  7,  7,  7,  6,  7,  7,  6,  5,
-     6,  6,  6,  6,  7,  7,  6,  6,  7,  6,  6,  4,  5,  5,  3
-  },
-  {
-     6,  6,  8,  4,  8,  8,  8,  4,  8,  8,  8,  4,  8,  8,  7,  4,
-     8,  8,  8,  5,  9,  9,  8,  6, 10, 10,  9,  5,  8,  8,  8,  4,
-     8,  8,  8,  6, 10, 10,  9,  5,  9,  9,  8,  5,  8,  8,  8,  4,
-     8,  8,  7,  5,  8,  8,  8,  5,  8,  8,  7,  3,  6,  6,  4
-  },
-  {
-     6,  6,  9,  3,  8,  8,  9,  3,  8,  8,  9,  4,  9,  9,  9,  3,
-     8,  8,  9,  5, 10, 10, 10,  6, 11, 11, 11,  5, 10, 10, 10,  3,
-     8,  8,  8,  6, 11, 11, 11,  5, 10, 10, 10,  5,  9,  9,  9,  4,
-     9,  9,  9,  5,  9,  9,  9,  5,  9,  9,  9,  5,  8,  8,  9
-  },
-  {
-     6,  6, 10,  3,  7,  7,  7,  3,  7,  7,  7,  4,  8,  8,  8,  3,
-     7,  7,  7,  5,  9,  9,  9,  6, 10, 10, 10,  6, 10, 10, 10,  3,
-     7,  7,  7,  6, 10, 10, 10,  5,  9,  9,  9,  6, 10, 10, 10,  4,
-     8,  8,  8,  6, 10, 10, 10,  5,  9,  9,  9,  6,  9,  9,  9
-  }
-};
-
-/* MacroBlock Transform Type: 7.1.3.11, p89
- * 8x8:B
- * 8x4:B:btm  8x4:B:top  8x4:B:both,
- * 4x8:B:right  4x8:B:left  4x8:B:both
- * 4x4:B  8x8:MB
- * 8x4:MB:btm  8x4:MB:top  8x4,MB,both
- * 4x8,MB,right  4x8,MB,left
- * 4x4,MB                               */
-const uint16_t ff_vc1_ttmb_codes[3][16] = {
-  {
-    0x0003,
-    0x002E, 0x005F, 0x0000,
-    0x0016, 0x0015, 0x0001,
-    0x0004, 0x0014,
-    0x02F1, 0x0179, 0x017B,
-    0x0BC0, 0x0BC1, 0x05E1,
-    0x017A
-  },
-  {
-    0x0006,
-    0x0006, 0x0003, 0x0007,
-    0x000F, 0x000E, 0x0000,
-    0x0002, 0x0002,
-    0x0014, 0x0011, 0x000B,
-    0x0009, 0x0021, 0x0015,
-    0x0020
-  },
-  {
-    0x0006,
-    0x0000, 0x000E, 0x0005,
-    0x0002, 0x0003, 0x0003,
-    0x000F, 0x0002,
-    0x0081, 0x0021, 0x0009,
-    0x0101, 0x0041, 0x0011,
-    0x0100
-  }
+const uint8_t ff_vc1_icbpcy_p_tabs[8][63][2] = {
+    {
+        { 0x3C,  3 }, { 0x3D,  3 }, { 0x1C,  8 }, { 0x1D,  8 }, { 0x2C,  8 },
+        { 0x2D,  8 }, { 0x34,  8 }, { 0x35,  8 }, { 0x38,  8 }, { 0x39,  8 },
+        { 0x03,  9 }, { 0x07,  9 }, { 0x0F,  9 }, { 0x1F,  9 }, { 0x0B,  8 },
+        { 0x0C,  9 }, { 0x0D,  9 }, { 0x13,  9 }, { 0x14, 10 }, { 0x15, 10 },
+        { 0x17, 10 }, { 0x18, 11 }, { 0x19, 11 }, { 0x23, 10 }, { 0x24, 11 },
+        { 0x25, 11 }, { 0x1B,  8 }, { 0x27,  9 }, { 0x28, 10 }, { 0x29, 10 },
+        { 0x2B,  8 }, { 0x2F,  8 }, { 0x30,  9 }, { 0x31,  9 }, { 0x33,  8 },
+        { 0x37,  8 }, { 0x04, 11 }, { 0x05, 11 }, { 0x08, 11 }, { 0x09, 11 },
+        { 0x10, 11 }, { 0x11, 11 }, { 0x20, 11 }, { 0x21, 11 }, { 0x1E,  7 },
+        { 0x2E,  7 }, { 0x36,  7 }, { 0x3A,  7 }, { 0x0A, 12 }, { 0x12, 12 },
+        { 0x22, 12 }, { 0x02, 14 }, { 0x00, 15 }, { 0x01, 15 }, { 0x06, 13 },
+        { 0x16, 10 }, { 0x0E,  9 }, { 0x32,  9 }, { 0x1A, 11 }, { 0x26, 11 },
+        { 0x2A, 10 }, { 0x3B,  3 }, { 0x3E,  1 },
+    },
+    {
+        { 0x3D,  3 }, { 0x10,  7 }, { 0x11,  7 }, { 0x1F,  6 }, { 0x20,  7 },
+        { 0x21,  7 }, { 0x22,  8 }, { 0x18,  9 }, { 0x19,  9 }, { 0x1A,  9 },
+        { 0x24,  9 }, { 0x25,  9 }, { 0x26,  9 }, { 0x1B,  6 }, { 0x2B,  6 },
+        { 0x33,  6 }, { 0x37,  6 }, { 0x0B,  6 }, { 0x0C,  7 }, { 0x0D,  7 },
+        { 0x0E,  7 }, { 0x13,  7 }, { 0x27,  7 }, { 0x30,  7 }, { 0x2F,  6 },
+        { 0x31,  7 }, { 0x32,  7 }, { 0x14,  8 }, { 0x15,  8 }, { 0x16,  8 },
+        { 0x17,  8 }, { 0x23,  8 }, { 0x28,  8 }, { 0x29,  8 }, { 0x2A,  8 },
+        { 0x1C,  7 }, { 0x1D,  7 }, { 0x1E,  6 }, { 0x2C,  7 }, { 0x2D,  7 },
+        { 0x2E,  6 }, { 0x34,  7 }, { 0x35,  7 }, { 0x36,  6 }, { 0x38,  7 },
+        { 0x39,  7 }, { 0x3A,  6 }, { 0x02,  9 }, { 0x06,  9 }, { 0x0A,  9 },
+        { 0x12,  9 }, { 0x00,  7 }, { 0x01,  7 }, { 0x03,  7 }, { 0x04,  8 },
+        { 0x05,  8 }, { 0x07,  7 }, { 0x08,  8 }, { 0x09,  8 }, { 0x0F,  7 },
+        { 0x3C,  4 }, { 0x3B,  3 }, { 0x3E,  2 },
+    },
+    {
+        { 0x3E,  2 }, { 0x3B,  3 }, { 0x3D,  4 }, { 0x0B,  5 }, { 0x2F,  5 },
+        { 0x27,  6 }, { 0x1B,  6 }, { 0x2B,  6 }, { 0x33,  6 }, { 0x37,  6 },
+        { 0x23,  7 }, { 0x1C,  7 }, { 0x03,  6 }, { 0x07,  6 }, { 0x0F,  6 },
+        { 0x1F,  6 }, { 0x1D,  7 }, { 0x2C,  7 }, { 0x1E,  6 }, { 0x2D,  7 },
+        { 0x34,  7 }, { 0x2E,  6 }, { 0x35,  7 }, { 0x38,  7 }, { 0x36,  6 },
+        { 0x3A,  6 }, { 0x39,  7 }, { 0x0C,  7 }, { 0x00,  6 }, { 0x01,  6 },
+        { 0x02,  5 }, { 0x0D,  7 }, { 0x14,  8 }, { 0x15,  8 }, { 0x18,  9 },
+        { 0x19,  9 }, { 0x24,  9 }, { 0x25,  9 }, { 0x28,  8 }, { 0x29,  8 },
+        { 0x30,  7 }, { 0x31,  7 }, { 0x04,  8 }, { 0x05,  8 }, { 0x08,  8 },
+        { 0x09,  8 }, { 0x10,  8 }, { 0x11,  8 }, { 0x20,  8 }, { 0x21,  8 },
+        { 0x16,  8 }, { 0x1A,  9 }, { 0x26,  9 }, { 0x0E,  7 }, { 0x32,  7 },
+        { 0x2A,  8 }, { 0x06,  9 }, { 0x0A,  9 }, { 0x12,  9 }, { 0x22,  9 },
+        { 0x17,  8 }, { 0x13,  7 }, { 0x3C,  5 },
+    },
+    {
+        { 0x03,  4 }, { 0x07,  4 }, { 0x0F,  4 }, { 0x1F,  4 }, { 0x17,  6 },
+        { 0x23,  6 }, { 0x27,  5 }, { 0x0B,  4 }, { 0x2F,  4 }, { 0x2E,  7 },
+        { 0x36,  7 }, { 0x3A,  7 }, { 0x0E,  7 }, { 0x1B,  5 }, { 0x2B,  5 },
+        { 0x33,  5 }, { 0x37,  5 }, { 0x1A,  9 }, { 0x26,  9 }, { 0x16,  8 },
+        { 0x32,  7 }, { 0x2A,  8 }, { 0x02,  8 }, { 0x1C,  8 }, { 0x1D,  8 },
+        { 0x00,  6 }, { 0x01,  6 }, { 0x2C,  8 }, { 0x2D,  8 }, { 0x34,  8 },
+        { 0x35,  8 }, { 0x38,  8 }, { 0x39,  8 }, { 0x14,  9 }, { 0x15,  9 },
+        { 0x28,  9 }, { 0x29,  9 }, { 0x3C,  5 }, { 0x3D,  5 }, { 0x3B,  3 },
+        { 0x3E,  4 }, { 0x0C,  8 }, { 0x0D,  8 }, { 0x30,  8 }, { 0x31,  8 },
+        { 0x18, 10 }, { 0x19, 10 }, { 0x24, 10 }, { 0x25, 10 }, { 0x04,  9 },
+        { 0x05,  9 }, { 0x06,  9 }, { 0x08,  9 }, { 0x09,  9 }, { 0x0A,  9 },
+        { 0x10,  9 }, { 0x11,  9 }, { 0x12,  9 }, { 0x20,  9 }, { 0x21,  9 },
+        { 0x22,  9 }, { 0x1E,  8 }, { 0x13,  6 },
+    },
+    {
+        { 0x39,  6 }, { 0x06,  7 }, { 0x0A,  7 }, { 0x12,  7 }, { 0x22,  7 },
+        { 0x0C,  6 }, { 0x0D,  6 }, { 0x14,  7 }, { 0x15,  7 }, { 0x18,  8 },
+        { 0x19,  8 }, { 0x24,  8 }, { 0x25,  8 }, { 0x28,  7 }, { 0x29,  7 },
+        { 0x30,  6 }, { 0x31,  6 }, { 0x16,  7 }, { 0x2A,  7 }, { 0x0E,  6 },
+        { 0x32,  6 }, { 0x1A,  8 }, { 0x26,  8 }, { 0x17,  7 }, { 0x0B,  5 },
+        { 0x2F,  5 }, { 0x13,  6 }, { 0x27,  6 }, { 0x03,  5 }, { 0x07,  5 },
+        { 0x0F,  5 }, { 0x1F,  5 }, { 0x3B,  4 }, { 0x3E,  3 }, { 0x3C,  5 },
+        { 0x3D,  5 }, { 0x1B,  6 }, { 0x2B,  6 }, { 0x33,  6 }, { 0x37,  6 },
+        { 0x23,  7 }, { 0x04,  7 }, { 0x05,  7 }, { 0x08,  7 }, { 0x09,  7 },
+        { 0x10,  7 }, { 0x11,  7 }, { 0x1C,  7 }, { 0x1D,  7 }, { 0x20,  7 },
+        { 0x1E,  6 }, { 0x21,  7 }, { 0x2C,  7 }, { 0x2D,  7 }, { 0x34,  7 },
+        { 0x2E,  6 }, { 0x35,  7 }, { 0x38,  7 }, { 0x36,  6 }, { 0x3A,  6 },
+        { 0x00,  6 }, { 0x01,  6 }, { 0x02,  5 },
+    },
+    {
+        { 0x3B,  3 }, { 0x3E,  4 }, { 0x0B,  4 }, { 0x13,  5 }, { 0x27,  5 },
+        { 0x2F,  4 }, { 0x17,  6 }, { 0x23,  6 }, { 0x3A,  7 }, { 0x16,  8 },
+        { 0x1A,  9 }, { 0x26,  9 }, { 0x0E,  7 }, { 0x32,  7 }, { 0x1B,  5 },
+        { 0x2B,  5 }, { 0x33,  5 }, { 0x37,  5 }, { 0x2A,  8 }, { 0x04,  8 },
+        { 0x05,  8 }, { 0x06,  8 }, { 0x08,  8 }, { 0x09,  8 }, { 0x0A,  8 },
+        { 0x10,  8 }, { 0x11,  8 }, { 0x12,  8 }, { 0x20,  8 }, { 0x21,  8 },
+        { 0x22,  8 }, { 0x02,  8 }, { 0x1C,  8 }, { 0x1D,  8 }, { 0x03,  4 },
+        { 0x07,  4 }, { 0x0F,  4 }, { 0x1F,  4 }, { 0x00,  6 }, { 0x01,  6 },
+        { 0x2C,  8 }, { 0x2D,  8 }, { 0x34,  8 }, { 0x35,  8 }, { 0x38,  8 },
+        { 0x39,  8 }, { 0x0C,  8 }, { 0x0D,  8 }, { 0x30,  8 }, { 0x31,  8 },
+        { 0x14,  9 }, { 0x15,  9 }, { 0x18, 10 }, { 0x19, 10 }, { 0x24, 10 },
+        { 0x25, 10 }, { 0x28,  9 }, { 0x29,  9 }, { 0x1E,  8 }, { 0x2E,  8 },
+        { 0x36,  8 }, { 0x3C,  6 }, { 0x3D,  6 },
+    },
+    {
+        { 0x03,  3 }, { 0x07,  3 }, { 0x0F,  3 }, { 0x1F,  3 }, { 0x22,  8 },
+        { 0x2C,  9 }, { 0x2D,  9 }, { 0x2E,  9 }, { 0x34,  9 }, { 0x35,  9 },
+        { 0x36,  9 }, { 0x17,  6 }, { 0x13,  5 }, { 0x0B,  4 }, { 0x2F,  4 },
+        { 0x27,  5 }, { 0x23,  6 }, { 0x38,  9 }, { 0x39,  9 }, { 0x3C,  8 },
+        { 0x3D,  8 }, { 0x04,  8 }, { 0x1B,  5 }, { 0x2B,  5 }, { 0x33,  5 },
+        { 0x37,  5 }, { 0x05,  8 }, { 0x08,  8 }, { 0x09,  8 }, { 0x10,  8 },
+        { 0x11,  8 }, { 0x20,  8 }, { 0x21,  8 }, { 0x3A,  9 }, { 0x02,  9 },
+        { 0x3B,  5 }, { 0x00,  6 }, { 0x01,  6 }, { 0x3E,  9 }, { 0x0C,  9 },
+        { 0x0D,  9 }, { 0x0E,  9 }, { 0x30,  9 }, { 0x31,  9 }, { 0x32,  9 },
+        { 0x14, 10 }, { 0x15, 10 }, { 0x16, 10 }, { 0x18, 11 }, { 0x19, 11 },
+        { 0x1A, 11 }, { 0x24, 11 }, { 0x25, 11 }, { 0x26, 11 }, { 0x28, 10 },
+        { 0x29, 10 }, { 0x2A, 10 }, { 0x1C, 10 }, { 0x06,  9 }, { 0x0A,  9 },
+        { 0x12,  9 }, { 0x1D, 10 }, { 0x1E, 10 },
+    },
+    {
+        { 0x37,  5 }, { 0x38,  9 }, { 0x39,  9 }, { 0x3A,  9 }, { 0x3E,  9 },
+        { 0x0C,  8 }, { 0x0D,  8 }, { 0x00,  6 }, { 0x01,  6 }, { 0x0E,  8 },
+        { 0x30,  8 }, { 0x31,  8 }, { 0x32,  8 }, { 0x14,  9 }, { 0x15,  9 },
+        { 0x16,  9 }, { 0x18, 10 }, { 0x19, 10 }, { 0x1A, 10 }, { 0x24, 10 },
+        { 0x25, 10 }, { 0x26, 10 }, { 0x28,  9 }, { 0x29,  9 }, { 0x06,  7 },
+        { 0x0A,  7 }, { 0x12,  7 }, { 0x22,  7 }, { 0x17,  6 }, { 0x13,  5 },
+        { 0x0B,  4 }, { 0x2F,  4 }, { 0x27,  5 }, { 0x23,  6 }, { 0x04,  7 },
+        { 0x05,  7 }, { 0x08,  7 }, { 0x09,  7 }, { 0x10,  7 }, { 0x11,  7 },
+        { 0x20,  7 }, { 0x21,  7 }, { 0x2A,  9 }, { 0x3C,  9 }, { 0x3D,  9 },
+        { 0x02, 10 }, { 0x1C, 10 }, { 0x1D, 10 }, { 0x1E, 10 }, { 0x2C, 10 },
+        { 0x2D, 10 }, { 0x2E, 10 }, { 0x34, 10 }, { 0x35, 10 }, { 0x36, 10 },
+        { 0x3B,  6 }, { 0x1B,  6 }, { 0x2B,  6 }, { 0x33,  6 }, { 0x03,  3 },
+        { 0x07,  3 }, { 0x0F,  3 }, { 0x1F,  3 },
+    },
 };
 
-const uint8_t ff_vc1_ttmb_bits[3][16] = {
-  {
-     2,
-     6,  7,  2,
-     5,  5,  2,
-     3,  5,
-    10,  9,  9,
-    12, 12, 11,
-     9
-  },
-  {
-    3,
-    4, 4, 4,
-    4, 4, 3,
-    3, 2,
-    7, 7, 6,
-    6, 8, 7,
-    8
-  },
-  {
-     3,
-     3, 4, 5,
-     3, 3, 4,
-     4, 2,
-    10, 8, 6,
-    11, 9, 7,
-    11
-  }
+/* MacroBlock Transform Type: 7.1.3.10, tables 54-56
+ * The "| 8" in the following table means that the transform type
+ * is valid for the whole macroblock. */
+const uint8_t ff_vc1_ttmb_tabs[3][16][2] = {
+    {
+        { TT_8X4, 2 }, { TT_4X8, 2 }, { TT_4X4, 3 }, { TT_8X8 | 8, 5 },
+        { TT_4X8_LEFT, 5 }, { TT_4X8_RIGHT, 5 }, { TT_8X4_BOTTOM, 6 },
+        { TT_4X8_RIGHT | 8, 12 }, { TT_4X8_LEFT | 8, 12 }, { TT_4X8 | 8, 11 },
+        { TT_8X4_BOTTOM | 8, 10 }, { TT_8X4_TOP | 8,  9 }, { TT_4X4 | 8,  9 },
+        { TT_8X4 | 8, 9 }, { TT_8X4_TOP, 7 }, { TT_8X8, 2 },
+    },
+    {
+        { TT_4X8, 3 }, { TT_4X4 | 8, 8 }, { TT_4X8_LEFT | 8, 8 },
+        { TT_8X4_TOP | 8, 7 }, { TT_4X8_RIGHT | 8, 6 }, { TT_8X4_BOTTOM | 8, 7 },
+        { TT_4X8 | 8, 7 }, { TT_8X4 | 8, 6 }, { TT_8X4_TOP, 4 }, { TT_4X4, 3 },
+        { TT_8X4_BOTTOM, 4 }, { TT_8X4, 4 }, { TT_8X8 | 8, 2 }, { TT_8X8, 3 },
+        { TT_4X8_LEFT, 4 }, { TT_4X8_RIGHT, 4 },
+    },
+    {
+        { TT_8X4_BOTTOM, 3 }, { TT_4X4 | 8, 11 }, { TT_4X8_RIGHT | 8, 11 },
+        { TT_8X4_BOTTOM | 8, 10 }, { TT_4X8_LEFT | 8, 9 }, { TT_8X4_TOP | 8, 8 },
+        { TT_4X8 | 8, 7 }, { TT_8X4 | 8, 6 }, { TT_8X4, 5 }, { TT_4X8, 4 },
+        { TT_4X8_RIGHT,  3 }, { TT_4X8_LEFT, 3 }, { TT_8X8 | 8, 2 },
+        { TT_8X8, 3 }, { TT_8X4_TOP, 4 }, { TT_4X4, 4 },
+    },
 };
 /* TTBLK (Transform Type per Block) tables */
 const uint8_t ff_vc1_ttblk_tabs[3][8][2] = {
diff --git a/libavcodec/vc1data.h b/libavcodec/vc1data.h
index 21dec20390..d376b35368 100644
--- a/libavcodec/vc1data.h
+++ b/libavcodec/vc1data.h
@@ -107,9 +107,11 @@ extern const uint8_t ff_vc1_imode_bits[7];
 /* Normal-2 imode */
 extern const uint8_t ff_vc1_norm2_codes[4];
 extern const uint8_t ff_vc1_norm2_bits[4];
-extern const uint16_t ff_vc1_norm6_codes[64];
-extern const uint8_t ff_vc1_norm6_bits[64];
-/* Normal-6 imode */
+/* Normal-6 imode (based upon table #81)
+ * The symbols contain the complete code of the tile, i.e.
+ * the possibly existing fixed length code resp. the second VLC
+ * are already incorporated. */
+extern const uint8_t ff_vc1_norm6_tab[77][2];
 extern const uint8_t ff_vc1_norm6_spec[64][5];
 
 /* 4MV Block pattern VLC tables */
@@ -122,25 +124,18 @@ extern const uint8_t ff_vc1_2mv_block_pattern_bits[4][4];
 
 extern const uint8_t ff_wmv3_dc_scale_table[32];
 
-/* P-Picture CBPCY VLC tables */
-extern const uint16_t ff_vc1_cbpcy_p_codes[4][64];
-extern const uint8_t ff_vc1_cbpcy_p_bits[4][64];
+/* P-Picture CBPCY VLC tables (Tables #169-#172) */
+extern const uint8_t ff_vc1_cbpcy_p_tabs[4][64][2];
 
 /* Interlaced CBPCY VLC tables (Table 124 - Table 131) */
-extern const uint16_t ff_vc1_icbpcy_p_codes[8][63];
-extern const uint8_t ff_vc1_icbpcy_p_bits[8][63];
-
-/* MacroBlock Transform Type: 7.1.3.11, p89
- * 8x8:B
- * 8x4:B:btm  8x4:B:top  8x4:B:both,
- * 4x8:B:right  4x8:B:left  4x8:B:both
- * 4x4:B  8x8:MB
- * 8x4:MB:btm  8x4:MB:top  8x4,MB,both
- * 4x8,MB,right  4x8,MB,left
- * 4x4,MB                               */
-extern const uint16_t ff_vc1_ttmb_codes[3][16];
-
-extern const uint8_t ff_vc1_ttmb_bits[3][16];
+extern const uint8_t ff_vc1_icbpcy_p_tabs[8][63][2];
+
+/* MacroBlock Transform Type (tables #54-#56):
+ * The lower three bits of the symbols contain
+ * an enum TransformTypes (TT_*) value containing Transform Type
+ * and Subblock Pattern; the 0x8 bit being set means that the value
+ * is valid for the whole macroblock. */
+extern const uint8_t ff_vc1_ttmb_tabs[3][16][2];
 
 /* TTBLK (Transform Type per Block) tables (tables #62-#64).
  * The symbols contain enum TransformTypes (TT_*) values. */
