]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vc9data.h
18% faster put_h264_qpel16_mc[13]2_mmx2
[ffmpeg] / libavcodec / vc9data.h
index 64afab3b888cecf7dfe60adf0de397b8cdbfbf6d..68e9d6e463e80d8f7a5b3657dc77e94c0852720d 100644 (file)
@@ -71,6 +71,87 @@ static const uint8_t vc9_norm2_bits[4] = {
   1, 3, 3, 2
 };
 
+static const uint16_t vc9_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,
+};
+
+static const uint8_t vc9_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,
+};
+/* Normal-6 imode */
+static const uint8_t vc9_norm6_spec[64][5] = {
+{ 0,  1, 1        },
+{ 1,  2, 4        },
+{ 2,  3, 4        },
+{ 3,  0, 8        },
+{ 4,  4, 4        },
+{ 5,  1, 8        },
+{ 6,  2, 8        },
+{ 7,  2, 5,  7, 5 },
+{ 8,  5, 4        },
+{ 9,  3, 8        },
+{10,  4, 8        },
+{11,  2, 5, 11, 5 },
+{12,  5, 8        },
+{13,  2, 5, 13, 5 },
+{14,  2, 5, 14, 5 },
+{15,  3, 5, 14, 8 },
+{16,  6, 4        },
+{17,  6, 8        },
+{18,  7, 8        },
+{19,  2, 5, 19, 5 },
+{20,  8, 8        },
+{21,  2, 5, 21, 5 },
+{22,  2, 5, 22, 5 },
+{23,  3, 5, 13, 8 },
+{24,  9, 8        },
+{25,  2, 5, 25, 5 },
+{26,  2, 5, 26, 5 },
+{27,  3, 5, 12, 8 },
+{28,  2, 5, 28, 5 },
+{29,  3, 5, 11, 8 },
+{30,  3, 5, 10, 8 },
+{31,  3, 5,  7, 4 },
+{32,  7, 4        },
+{33, 10, 8        },
+{34, 11, 8        },
+{35,  2, 5,  3, 5 },
+{36, 12, 8        },
+{37,  2, 5,  5, 5 },
+{38,  2, 5,  6, 5 },
+{39,  3, 5,  9, 8 },
+{40, 13, 8        },
+{41,  2, 5,  9, 5 },
+{42,  2, 5, 10, 5 },
+{43,  3, 5,  8, 8 },
+{44,  2, 5, 12, 5 },
+{45,  3, 5,  7, 8 },
+{46,  3, 5,  6, 8 },
+{47,  3, 5,  6, 4 },
+{48, 14, 8        },
+{49,  2, 5, 17, 5 },
+{50,  2, 5, 18, 5 },
+{51,  3, 5,  5, 8 },
+{52,  2, 5, 20, 5 },
+{53,  3, 5,  4, 8 },
+{54,  3, 5,  3, 8 },
+{55,  3, 5,  5, 4 },
+{56,  2, 5, 24, 5 },
+{57,  3, 5,  2, 8 },
+{58,  3, 5,  1, 8 },
+{59,  3, 5,  4, 4 },
+{60,  3, 5,  0, 8 },
+{61,  3, 5,  3, 4 },
+{62,  3, 5,  2, 4 },
+{63,  3, 5,  1, 1 },
+};
+
 /* 4MV Block pattern VLC tables */
 static const uint8_t vc9_4mv_block_pattern_codes[4][16] = {
   { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27,  0, 28,  1,  2,  2},
@@ -85,23 +166,8 @@ static const uint8_t vc9_4mv_block_pattern_bits[4][16] = {
   { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
 };
 
-/* I-Picture CBPCY VLC tables */
-//same as msmpeg4 table_mb_intra
-static const uint16_t vc9_cbpcy_i_codes[64] = {
-     1,   23,    9,    5,    6,   71,   32,   16,
-     2,  124,   58,   29,    2,  236,  119,    0,
-     3,  183,   44,   19,    1,  360,   70,   63,
-    30, 1810,  181,   66,   34,  453,  286,  135,
-     6,    3,   30,   28,   18,  904,   68,  112,
-    31,  574,   57,  142,    1,  454,  182,   69,
-    20,  575,  125,   24,    7,  455,  134,   25,
-    21,  475,    2,   70,   13, 1811,  474,  361
-};
-static const uint8_t vc9_cbpcy_i_bits[64] = {
-   1,  6,  5,  5,  5,  9,  7,  7,  5,  9,  7,  7,  6,  9,  8,  8,
-   5,  9,  7,  7,  6, 10,  8,  8,  6, 13,  9,  8,  7, 11, 10,  9,
-   4,  9,  7,  6,  7, 12,  9,  9,  6, 11,  8,  9,  7, 11,  9,  9,
-   6, 11,  9,  9,  7, 11,  9,  9,  6, 10,  9,  9,  8, 13, 10, 10
+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
 };
 
 /* P-Picture CBPCY VLC tables */
@@ -158,7 +224,7 @@ static const uint8_t vc9_cbpcy_p_bits[4][64] = {
   }
 };
 
-/* MacroBlock Transform Type
+/* 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
@@ -190,7 +256,7 @@ static const uint16_t vc9_ttmb_codes[3][16] = {
     0x0000, 0x000E, 0x0005,
     0x0002, 0x0003, 0x0003,
     0x000F, 0x0002,
-    0x0081, 0x0011, 0x0009,
+    0x0081, 0x0021, 0x0009,
     0x0101, 0x0041, 0x0011,
     0x0100
   }
@@ -220,12 +286,35 @@ static const uint8_t vc9_ttmb_bits[3][16] = {
      3, 4, 5,
      3, 3, 4,
      4, 2,
-     9, 7, 6,
-    10, 9, 7,
+    10, 8, 6,
+    11, 9, 7,
     11
   }
-};  
+};
+
+/* TTBLK (Transform Type per Block) tables */
+static const uint8_t vc9_ttblk_codes[3][8] = {
+  {  0,  1,  3,  5, 16, 17, 18, 19},
+  {  3,  0,  1,  2,  3,  5,  8,  9},
+  {  1,  0,  1,  4,  6,  7, 10, 11}
+};
+static const uint8_t vc9_ttblk_bits[3][8] = {
+  {  2,  2,  2,  3,  5,  5,  5,  5},
+  {  2,  3,  3,  3,  3,  3,  4,  4},
+  {  2,  3,  3,  3,  3,  3,  4,  4}
+};
 
+/* SUBBLKPAT tables, p93-94, reordered */
+static const uint8_t vc9_subblkpat_codes[3][15] = {
+  { 14, 12,  7, 11,  9, 26,  2, 10, 27,  8,  0,  6,  1, 15,  1},
+  { 14,  0,  8, 15, 10,  4, 23, 13,  5,  9, 25,  3, 24, 22,  1},
+  {  5,  6,  2,  2,  8,  0, 28,  3,  1,  3, 29,  1, 19, 18, 15}
+};
+static const uint8_t vc9_subblkpat_bits[3][15] = {
+  {  5,  5,  5,  5,  5,  6,  4,  5,  6,  5,  4,  5,  4,  5,  1},
+  {  4,  3,  4,  4,  4,  5,  5,  4,  5,  4,  5,  4,  5,  5,  2},
+  {  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4}
+};
 
 /* MV differential tables, p265 */
 static const uint16_t vc9_mv_diff_codes[4][73] = {
@@ -292,7 +381,7 @@ static const uint8_t vc9_mv_diff_bits[4][73] = {
     14, 14, 14, 14,  2,  3,  6,  8,  8,  6,  3,  4,  6,  8,  6,  9,
      6,  6,  6,  8,  8,  8, 14,  7,  7,  8,  7,  9, 13,  9,  8,  9,
     13,  9, 13, 13, 13, 13, 13, 13,  5 /* 73 elements */
-     
+
   },
   {
      3, 12, 12, 12, 12,  3,  4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
@@ -310,66 +399,8 @@ static const uint8_t vc9_mv_diff_bits[4][73] = {
   }
 };
 
-/* DC luma differentials low+hi-mo, p217 */
-//same as msmpeg4 table0/1_dc_lum
-static const uint32_t vc9_luma_dc_codes[2][120] = {
-  {
-          1,       1,       1,       1,       5,       7,       8,      12,
-          0,       2,      18,      26,       3,       7,      39,      55,
-          5,      76,     108,     109,       8,      25,     155,      27,
-        154,      19,      52,      53,      97,      72,     196,      74,
-        198,     199,     146,     395,     147,     387,     386,     150,
-        151,     384,     788,     789,    1541,    1540,    1542,    3086,
-     197581,  197577,  197576,  197578,  197579,  197580,  197582,  197583,
-     197584,  197585,  197586,  197587,  197588,  197589,  197590,  197591,
-     197592,  197593,  197594,  197595,  197596,  197597,  197598,  197599,
-     197600,  197601,  197602,  197603,  197604,  197605,  197606,  197607,
-     197608,  197609,  197610,  197611,  197612,  197613,  197614,  197615,
-     197616,  197617,  197618,  197619,  197620,  197621,  197622,  197623,
-     197624,  197625,  197626,  197627,  197628,  197629,  197630,  197631,
-     395136,  395137,  395138,  395139,  395140,  395141,  395142,  395143,
-     395144,  395145,  395146,  395147,  395148,  395149,  395150,  395151
-  },
-  {
-          2,       3,       3,       2,       5,       1,       3,       8,
-          0,       5,      13,      15,      19,       8,      24,      28,
-         36,       4,       6,      18,      50,      59,      74,      75, 
-         11,      38,      39,     102,     116,     117,      20,      28,
-         31,      29,      43,      61,     413,     415,      84,     825,
-        824,     829,     171,     241,    1656,     242,     480,     481,
-        340,    3314,     972,     683,    6631,     974,    6630,    1364,
-       1951,    1365,    3901,    3895,    3900,    3893,    7789,    7784,
-      15576,   15571,   15577,   31140,  996538,  996532,  996533,  996534,
-     996535,  996536,  996537,  996539,  996540,  996541,  996542,  996543,
-    1993024, 1993025, 1993026, 1993027, 1993029, 1993029, 1993030, 1993031,
-    1993032, 1993033, 1993034, 1993035, 1993036, 1993037, 1993038, 1993039,
-    1993040, 1993041, 1993042, 1993043, 1993044, 1993045, 1993046, 1993047,
-    1993048, 1993049, 1993050, 1993051, 1993052, 1993053, 1993054, 1993055,
-    1993056, 1993057, 1993058, 1993059, 1993060, 1993061, 1993062, 1993063
-  }
-};
-static const uint8_t vc9_luma_dc_bits[2][120] = {
-  {
-      1,  2,  4,  5,  5,  5,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
-      9,  9,  9,  9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 13, 13, 13,
-     13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 16, 16, 16, 17,
-     23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-     23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-     23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-     23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
-     24, 24, 24, 24, 24, 24, 24, 24 /* lowmo, 120 values */
-  },
-  {
-      2,  2,  3,  4,  4,  5,  5,  5,  6,  6,  6,  6,  6,  7,  7,  7,
-      7,  8,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9, 10, 10,
-     10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14,
-     14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18,
-     19, 19, 19, 20, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-     26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-     26, 26, 26, 26, 26, 26, 26, 26 /* himo, 120 values */
-  }
-};
+/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
 
-/* DC chroma differentials low+hi-mo */
+/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
 
 #endif /* VC9DATA_H */