00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #include "mpeg12data.h"
00029
00030 const uint16_t ff_mpeg1_default_intra_matrix[64] = {
00031 8, 16, 19, 22, 26, 27, 29, 34,
00032 16, 16, 22, 24, 27, 29, 34, 37,
00033 19, 22, 26, 27, 29, 34, 34, 38,
00034 22, 22, 26, 27, 29, 34, 37, 40,
00035 22, 26, 27, 29, 32, 35, 40, 48,
00036 26, 27, 29, 32, 35, 40, 48, 58,
00037 26, 27, 29, 34, 38, 46, 56, 69,
00038 27, 29, 35, 38, 46, 56, 69, 83
00039 };
00040
00041 const uint16_t ff_mpeg1_default_non_intra_matrix[64] = {
00042 16, 16, 16, 16, 16, 16, 16, 16,
00043 16, 16, 16, 16, 16, 16, 16, 16,
00044 16, 16, 16, 16, 16, 16, 16, 16,
00045 16, 16, 16, 16, 16, 16, 16, 16,
00046 16, 16, 16, 16, 16, 16, 16, 16,
00047 16, 16, 16, 16, 16, 16, 16, 16,
00048 16, 16, 16, 16, 16, 16, 16, 16,
00049 16, 16, 16, 16, 16, 16, 16, 16,
00050 };
00051
00052 const uint16_t ff_mpeg12_vlc_dc_lum_code[12] = {
00053 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
00054 };
00055 const unsigned char ff_mpeg12_vlc_dc_lum_bits[12] = {
00056 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
00057 };
00058
00059 const uint16_t ff_mpeg12_vlc_dc_chroma_code[12] = {
00060 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
00061 };
00062 const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12] = {
00063 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
00064 };
00065
00066 static const uint16_t mpeg1_vlc[113][2] = {
00067 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
00068 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
00069 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
00070 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
00071 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
00072 { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 },
00073 { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 },
00074 { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 },
00075 { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 },
00076 { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 },
00077 { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 },
00078 { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 },
00079 { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 },
00080 { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 },
00081 { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 },
00082 { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 },
00083 { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 },
00084 { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 },
00085 { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 },
00086 { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 },
00087 { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
00088 { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 },
00089 { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 },
00090 { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 },
00091 { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 },
00092 { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 },
00093 { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 },
00094 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
00095 { 0x1, 6 },
00096 { 0x2, 2 },
00097 };
00098
00099 static const uint16_t mpeg2_vlc[113][2] = {
00100 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
00101 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
00102 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
00103 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
00104 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
00105 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
00106 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
00107 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
00108 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
00109 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15},
00110 {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
00111 {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
00112 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
00113 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
00114 {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
00115 {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
00116 {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
00117 {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
00118 {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
00119 {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
00120 {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
00121 {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
00122 {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
00123 {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
00124 {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
00125 {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
00126 {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
00127 {0x1d,16}, {0x1c,16}, {0x1b,16},
00128 {0x01,6},
00129 {0x06,4},
00130 };
00131
00132 static const int8_t mpeg1_level[111] = {
00133 1, 2, 3, 4, 5, 6, 7, 8,
00134 9, 10, 11, 12, 13, 14, 15, 16,
00135 17, 18, 19, 20, 21, 22, 23, 24,
00136 25, 26, 27, 28, 29, 30, 31, 32,
00137 33, 34, 35, 36, 37, 38, 39, 40,
00138 1, 2, 3, 4, 5, 6, 7, 8,
00139 9, 10, 11, 12, 13, 14, 15, 16,
00140 17, 18, 1, 2, 3, 4, 5, 1,
00141 2, 3, 4, 1, 2, 3, 1, 2,
00142 3, 1, 2, 3, 1, 2, 1, 2,
00143 1, 2, 1, 2, 1, 2, 1, 2,
00144 1, 2, 1, 2, 1, 2, 1, 2,
00145 1, 1, 1, 1, 1, 1, 1, 1,
00146 1, 1, 1, 1, 1, 1, 1,
00147 };
00148
00149 static const int8_t mpeg1_run[111] = {
00150 0, 0, 0, 0, 0, 0, 0, 0,
00151 0, 0, 0, 0, 0, 0, 0, 0,
00152 0, 0, 0, 0, 0, 0, 0, 0,
00153 0, 0, 0, 0, 0, 0, 0, 0,
00154 0, 0, 0, 0, 0, 0, 0, 0,
00155 1, 1, 1, 1, 1, 1, 1, 1,
00156 1, 1, 1, 1, 1, 1, 1, 1,
00157 1, 1, 2, 2, 2, 2, 2, 3,
00158 3, 3, 3, 4, 4, 4, 5, 5,
00159 5, 6, 6, 6, 7, 7, 8, 8,
00160 9, 9, 10, 10, 11, 11, 12, 12,
00161 13, 13, 14, 14, 15, 15, 16, 16,
00162 17, 18, 19, 20, 21, 22, 23, 24,
00163 25, 26, 27, 28, 29, 30, 31,
00164 };
00165
00166 RLTable ff_rl_mpeg1 = {
00167 111,
00168 111,
00169 mpeg1_vlc,
00170 mpeg1_run,
00171 mpeg1_level,
00172 };
00173
00174 RLTable ff_rl_mpeg2 = {
00175 111,
00176 111,
00177 mpeg2_vlc,
00178 mpeg1_run,
00179 mpeg1_level,
00180 };
00181
00182 const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] = {
00183 {0x1, 1},
00184 {0x3, 3},
00185 {0x2, 3},
00186 {0x3, 4},
00187 {0x2, 4},
00188 {0x3, 5},
00189 {0x2, 5},
00190 {0x7, 7},
00191 {0x6, 7},
00192 {0xb, 8},
00193 {0xa, 8},
00194 {0x9, 8},
00195 {0x8, 8},
00196 {0x7, 8},
00197 {0x6, 8},
00198 {0x17, 10},
00199 {0x16, 10},
00200 {0x15, 10},
00201 {0x14, 10},
00202 {0x13, 10},
00203 {0x12, 10},
00204 {0x23, 11},
00205 {0x22, 11},
00206 {0x21, 11},
00207 {0x20, 11},
00208 {0x1f, 11},
00209 {0x1e, 11},
00210 {0x1d, 11},
00211 {0x1c, 11},
00212 {0x1b, 11},
00213 {0x1a, 11},
00214 {0x19, 11},
00215 {0x18, 11},
00216 {0x8, 11},
00217 {0xf, 11},
00218 {0x0, 8},
00219 };
00220
00221 const uint8_t ff_mpeg12_mbPatTable[64][2] = {
00222 {0x1, 9},
00223 {0xb, 5},
00224 {0x9, 5},
00225 {0xd, 6},
00226 {0xd, 4},
00227 {0x17, 7},
00228 {0x13, 7},
00229 {0x1f, 8},
00230 {0xc, 4},
00231 {0x16, 7},
00232 {0x12, 7},
00233 {0x1e, 8},
00234 {0x13, 5},
00235 {0x1b, 8},
00236 {0x17, 8},
00237 {0x13, 8},
00238 {0xb, 4},
00239 {0x15, 7},
00240 {0x11, 7},
00241 {0x1d, 8},
00242 {0x11, 5},
00243 {0x19, 8},
00244 {0x15, 8},
00245 {0x11, 8},
00246 {0xf, 6},
00247 {0xf, 8},
00248 {0xd, 8},
00249 {0x3, 9},
00250 {0xf, 5},
00251 {0xb, 8},
00252 {0x7, 8},
00253 {0x7, 9},
00254 {0xa, 4},
00255 {0x14, 7},
00256 {0x10, 7},
00257 {0x1c, 8},
00258 {0xe, 6},
00259 {0xe, 8},
00260 {0xc, 8},
00261 {0x2, 9},
00262 {0x10, 5},
00263 {0x18, 8},
00264 {0x14, 8},
00265 {0x10, 8},
00266 {0xe, 5},
00267 {0xa, 8},
00268 {0x6, 8},
00269 {0x6, 9},
00270 {0x12, 5},
00271 {0x1a, 8},
00272 {0x16, 8},
00273 {0x12, 8},
00274 {0xd, 5},
00275 {0x9, 8},
00276 {0x5, 8},
00277 {0x5, 9},
00278 {0xc, 5},
00279 {0x8, 8},
00280 {0x4, 8},
00281 {0x4, 9},
00282 {0x7, 3},
00283 {0xa, 5},
00284 {0x8, 5},
00285 {0xc, 6}
00286 };
00287
00288 const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = {
00289 { 0x1, 1 },
00290 { 0x1, 2 },
00291 { 0x1, 3 },
00292 { 0x1, 4 },
00293 { 0x3, 6 },
00294 { 0x5, 7 },
00295 { 0x4, 7 },
00296 { 0x3, 7 },
00297 { 0xb, 9 },
00298 { 0xa, 9 },
00299 { 0x9, 9 },
00300 { 0x11, 10 },
00301 { 0x10, 10 },
00302 { 0xf, 10 },
00303 { 0xe, 10 },
00304 { 0xd, 10 },
00305 { 0xc, 10 },
00306 };
00307
00308 const AVRational avpriv_frame_rate_tab[] = {
00309 { 0, 0},
00310 {24000, 1001},
00311 { 24, 1},
00312 { 25, 1},
00313 {30000, 1001},
00314 { 30, 1},
00315 { 50, 1},
00316 {60000, 1001},
00317 { 60, 1},
00318
00319 { 15, 1},
00320
00321 { 5, 1},
00322 { 10, 1},
00323 { 12, 1},
00324 { 15, 1},
00325 { 0, 0},
00326 };
00327
00328 const float ff_mpeg1_aspect[16]={
00329 0.0000,
00330 1.0000,
00331 0.6735,
00332 0.7031,
00333
00334 0.7615,
00335 0.8055,
00336 0.8437,
00337 0.8935,
00338
00339 0.9157,
00340 0.9815,
00341 1.0255,
00342 1.0695,
00343
00344 1.0950,
00345 1.1575,
00346 1.2015,
00347 };
00348
00349 const AVRational ff_mpeg2_aspect[16]={
00350 {0,1},
00351 {1,1},
00352 {4,3},
00353 {16,9},
00354 {221,100},
00355 {0,1},
00356 {0,1},
00357 {0,1},
00358 {0,1},
00359 {0,1},
00360 {0,1},
00361 {0,1},
00362 {0,1},
00363 {0,1},
00364 {0,1},
00365 {0,1},
00366 };