00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00027 #ifndef AVCODEC_H261DATA_H
00028 #define AVCODEC_H261DATA_H
00029
00030 #include <stdint.h>
00031 #include "h261.h"
00032
00033
00034 static const uint8_t h261_mba_code[35] = {
00035 1, 3, 2, 3,
00036 2, 3, 2, 7,
00037 6, 11, 10, 9,
00038 8, 7, 6, 23,
00039 22, 21, 20, 19,
00040 18, 35, 34, 33,
00041 32, 31, 30, 29,
00042 28, 27, 26, 25,
00043 24,
00044 15,
00045 1
00046 };
00047
00048 static const uint8_t h261_mba_bits[35] = {
00049 1, 3, 3, 4,
00050 4, 5, 5, 7,
00051 7, 8, 8, 8,
00052 8, 8, 8, 10,
00053 10, 10, 10, 10,
00054 10, 11, 11, 11,
00055 11, 11, 11, 11,
00056 11, 11, 11, 11,
00057 11,
00058 11,
00059 16
00060 };
00061
00062
00063 static const uint8_t h261_mtype_code[10] = {
00064 1, 1, 1, 1,
00065 1, 1, 1, 1,
00066 1, 1
00067 };
00068
00069 static const uint8_t h261_mtype_bits[10] = {
00070 4, 7, 1, 5,
00071 9, 8, 10, 3,
00072 2, 6
00073 };
00074
00075 static const int h261_mtype_map[10]= {
00076 MB_TYPE_INTRA4x4,
00077 MB_TYPE_INTRA4x4 | MB_TYPE_QUANT,
00078 MB_TYPE_CBP,
00079 MB_TYPE_QUANT | MB_TYPE_CBP,
00080 MB_TYPE_16x16,
00081 MB_TYPE_CBP | MB_TYPE_16x16,
00082 MB_TYPE_QUANT | MB_TYPE_CBP | MB_TYPE_16x16,
00083 MB_TYPE_16x16 | MB_TYPE_H261_FIL,
00084 MB_TYPE_CBP | MB_TYPE_16x16 | MB_TYPE_H261_FIL,
00085 MB_TYPE_QUANT | MB_TYPE_CBP | MB_TYPE_16x16 | MB_TYPE_H261_FIL
00086 };
00087
00088
00089 static const uint8_t h261_mv_tab[17][2] = {
00090 {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
00091 {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10}, {12,10}
00092 };
00093
00094 static const int mvmap[17] =
00095 {
00096 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16
00097 };
00098
00099
00100 static const uint8_t h261_cbp_tab[63][2] =
00101 {
00102 {11,5}, {9,5}, {13,6}, {13,4}, {23,7}, {19,7}, {31,8}, {12,4},
00103 {22,7}, {18,7}, {30,8}, {19,5}, {27,8}, {23,8}, {19,8}, {11,4},
00104 {21,7}, {17,7}, {29,8}, {17,5}, {25,8}, {21,8}, {17,8}, {15,6},
00105 {15,8}, {13,8}, {3,9}, {15,5}, {11,8}, {7,8}, {7,9}, {10,4},
00106 {20,7}, {16,7}, {28,8}, {14,6}, {14,8}, {12,8}, {2,9}, {16,5},
00107 {24,8}, {20,8}, {16,8}, {14,5}, {10,8}, {6,8}, {6,9}, {18,5},
00108 {26,8}, {22,8}, {18,8}, {13,5}, {9,8}, {5,8}, {5,9}, {12,5},
00109 {8,8}, {4,8}, {4,9}, {7,3}, {10,5}, {8,5}, {12,6}
00110 };
00111
00112
00113 static const uint16_t h261_tcoeff_vlc[65][2] = {
00114 { 0x2, 2 }, { 0x3, 2 },{ 0x4, 4 },{ 0x5, 5 },
00115 { 0x6, 7 },{ 0x26, 8 },{ 0x21, 8 },{ 0xa, 10 },
00116 { 0x1d, 12 },{ 0x18, 12 },{ 0x13, 12 },{ 0x10 , 12 },
00117 { 0x1a, 13},{ 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 },
00118 { 0x3, 3 }, { 0x6, 6 }, { 0x25 , 8 }, { 0xc, 10 },
00119 { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x5, 4},
00120 { 0x4, 7}, { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 },
00121 { 0x7, 5 }, { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 },
00122 { 0x6, 5 }, { 0xf, 10 }, { 0x12, 12}, { 0x7, 6},
00123 { 0x9 , 10 }, { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 },
00124 { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12},
00125 { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
00126 { 0x23, 8 }, { 0x22, 8 }, { 0x20, 8 }, { 0xe , 10 },
00127 { 0xd, 10 }, { 0x8, 10 },{ 0x1f, 12 }, { 0x1a, 12 },
00128 { 0x19, 12 }, { 0x17, 12 }, { 0x16, 12}, { 0x1f, 13},
00129 { 0x1e, 13 }, { 0x1d, 13 }, { 0x1c, 13}, { 0x1b, 13},
00130 { 0x1, 6 }
00131 };
00132
00133 static const int8_t h261_tcoeff_level[64] = {
00134 0, 1, 2, 3, 4, 5, 6, 7,
00135 8, 9, 10, 11, 12, 13, 14, 15,
00136 1, 2, 3, 4, 5, 6, 7, 1,
00137 2, 3, 4, 5, 1, 2, 3, 4,
00138 1, 2, 3, 1, 2, 3, 1, 2,
00139 1, 2, 1, 2, 1, 2, 1, 2,
00140 1, 1, 1, 1, 1, 1, 1, 1,
00141 1, 1, 1, 1, 1, 1, 1, 1
00142 };
00143
00144 static const int8_t h261_tcoeff_run[64] = {
00145 0,
00146 0, 0, 0, 0, 0, 0, 0, 0,
00147 0, 0, 0, 0, 0, 0, 0, 1,
00148 1, 1, 1, 1, 1, 1, 2, 2,
00149 2, 2, 2, 3, 3, 3, 3, 4,
00150 4, 4, 5, 5, 5, 6, 6, 7,
00151 7, 8, 8, 9, 9, 10, 10, 11,
00152 12, 13, 14, 15, 16, 17, 18, 19,
00153 20, 21, 22, 23, 24, 25, 26
00154 };
00155
00156 static RLTable h261_rl_tcoeff = {
00157 64,
00158 64,
00159 h261_tcoeff_vlc,
00160 h261_tcoeff_run,
00161 h261_tcoeff_level,
00162 };
00163
00164 #endif