00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #include "avcodec.h"
00029 #include "vc1.h"
00030 #include "vc1data.h"
00031
00033 const int ff_vc1_ttblk_to_tt[3][8] = {
00034 { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT },
00035 { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP },
00036 { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP }
00037 };
00038
00039 const int ff_vc1_ttfrm_to_tt[4] = { TT_8X8, TT_8X4, TT_4X8, TT_4X4 };
00040
00042 const uint8_t ff_vc1_mv_pmode_table[2][5] = {
00043 { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV },
00044 { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN }
00045 };
00046 const uint8_t ff_vc1_mv_pmode_table2[2][4] = {
00047 { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV },
00048 { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN }
00049 };
00050
00051 const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
00052 ff_vc1_fps_dr[2] = { 1000, 1001 };
00053 const uint8_t ff_vc1_pquant_table[3][32] = {
00054 {
00055 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12,
00056 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31
00057 },
00058 {
00059 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
00060 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
00061 },
00062 {
00063 0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
00064 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31
00065 }
00066 };
00067
00072 #define VC1_BFRACTION_VLC_BITS 7
00073 VLC ff_vc1_bfraction_vlc;
00074 #define VC1_IMODE_VLC_BITS 4
00075 VLC ff_vc1_imode_vlc;
00076 #define VC1_NORM2_VLC_BITS 3
00077 VLC ff_vc1_norm2_vlc;
00078 #define VC1_NORM6_VLC_BITS 9
00079 VLC ff_vc1_norm6_vlc;
00080
00081 #define VC1_TTMB_VLC_BITS 9 //12
00082 VLC ff_vc1_ttmb_vlc[3];
00083 #define VC1_MV_DIFF_VLC_BITS 9 //15
00084 VLC ff_vc1_mv_diff_vlc[4];
00085 #define VC1_CBPCY_P_VLC_BITS 9 //14
00086 VLC ff_vc1_cbpcy_p_vlc[4];
00087 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
00088 VLC ff_vc1_4mv_block_pattern_vlc[4];
00089 #define VC1_TTBLK_VLC_BITS 5
00090 VLC ff_vc1_ttblk_vlc[3];
00091 #define VC1_SUBBLKPAT_VLC_BITS 6
00092 VLC ff_vc1_subblkpat_vlc[3];
00093
00094 VLC ff_vc1_ac_coeff_table[8];
00096
00097
00098 #if B_FRACTION_DEN==840 //original bfraction from vc9data.h, not conforming to standard
00099
00100 const int16_t ff_vc1_bfraction_lut[23] = {
00101 420 , 280 , 560 , 210 ,
00102 630 , 168 , 336 ,
00103 504 , 672 , 140 , 700 ,
00104 120 , 240 , 360 , 480 ,
00105 600 , 720 , 105 , 315 ,
00106 525 , 735 ,
00107 -1 , 0
00108 };
00109 #else
00110
00111 const int16_t ff_vc1_bfraction_lut[23] = {
00112 128 , 85 , 170 , 64 ,
00113 192 , 51 , 102 ,
00114 153 , 204 , 43 , 215 ,
00115 37 , 74 , 111 , 148 ,
00116 185 , 222 , 32 , 96 ,
00117 160 , 224 ,
00118 -1 , 0
00119 };
00120 #endif
00121
00122 const uint8_t ff_vc1_bfraction_bits[23] = {
00123 3, 3, 3, 3,
00124 3, 3, 3,
00125 7, 7, 7, 7,
00126 7, 7, 7, 7,
00127 7, 7, 7, 7,
00128 7, 7,
00129 7, 7
00130 };
00131 const uint8_t ff_vc1_bfraction_codes[23] = {
00132 0, 1, 2, 3,
00133 4, 5, 6,
00134 112, 113, 114, 115,
00135 116, 117, 118, 119,
00136 120, 121, 122, 123,
00137 124, 125,
00138 126, 127
00139 };
00140
00141
00142 const AVRational ff_vc1_pixel_aspect[16]={
00143 {0, 1},
00144 {1, 1},
00145 {12, 11},
00146 {10, 11},
00147 {16, 11},
00148 {40, 33},
00149 {24, 11},
00150 {20, 11},
00151 {32, 11},
00152 {80, 33},
00153 {18, 11},
00154 {15, 11},
00155 {64, 33},
00156 {160, 99},
00157 {0, 1},
00158 {0, 1}
00159 };
00160
00161
00162 const uint8_t ff_vc1_imode_codes[7] = {
00163 0, 2, 1, 3, 1, 2, 3
00164 };
00165 const uint8_t ff_vc1_imode_bits[7] = {
00166 4, 2, 3, 2, 4, 3, 3
00167 };
00168
00169
00170 const uint8_t ff_vc1_norm2_codes[4] = {
00171 0, 4, 5, 3
00172 };
00173 const uint8_t ff_vc1_norm2_bits[4] = {
00174 1, 3, 3, 2
00175 };
00176
00177 const uint16_t ff_vc1_norm6_codes[64] = {
00178 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
00179 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
00180 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
00181 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
00182 };
00183
00184 const uint8_t ff_vc1_norm6_bits[64] = {
00185 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13,
00186 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
00187 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
00188 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
00189 };
00190 #if 0
00191
00192 const uint8_t ff_vc1_norm6_spec[64][5] = {
00193 { 0, 1, 1 },
00194 { 1, 2, 4 },
00195 { 2, 3, 4 },
00196 { 3, 0, 8 },
00197 { 4, 4, 4 },
00198 { 5, 1, 8 },
00199 { 6, 2, 8 },
00200 { 7, 2, 5, 7, 5 },
00201 { 8, 5, 4 },
00202 { 9, 3, 8 },
00203 {10, 4, 8 },
00204 {11, 2, 5, 11, 5 },
00205 {12, 5, 8 },
00206 {13, 2, 5, 13, 5 },
00207 {14, 2, 5, 14, 5 },
00208 {15, 3, 5, 14, 8 },
00209 {16, 6, 4 },
00210 {17, 6, 8 },
00211 {18, 7, 8 },
00212 {19, 2, 5, 19, 5 },
00213 {20, 8, 8 },
00214 {21, 2, 5, 21, 5 },
00215 {22, 2, 5, 22, 5 },
00216 {23, 3, 5, 13, 8 },
00217 {24, 9, 8 },
00218 {25, 2, 5, 25, 5 },
00219 {26, 2, 5, 26, 5 },
00220 {27, 3, 5, 12, 8 },
00221 {28, 2, 5, 28, 5 },
00222 {29, 3, 5, 11, 8 },
00223 {30, 3, 5, 10, 8 },
00224 {31, 3, 5, 7, 4 },
00225 {32, 7, 4 },
00226 {33, 10, 8 },
00227 {34, 11, 8 },
00228 {35, 2, 5, 3, 5 },
00229 {36, 12, 8 },
00230 {37, 2, 5, 5, 5 },
00231 {38, 2, 5, 6, 5 },
00232 {39, 3, 5, 9, 8 },
00233 {40, 13, 8 },
00234 {41, 2, 5, 9, 5 },
00235 {42, 2, 5, 10, 5 },
00236 {43, 3, 5, 8, 8 },
00237 {44, 2, 5, 12, 5 },
00238 {45, 3, 5, 7, 8 },
00239 {46, 3, 5, 6, 8 },
00240 {47, 3, 5, 6, 4 },
00241 {48, 14, 8 },
00242 {49, 2, 5, 17, 5 },
00243 {50, 2, 5, 18, 5 },
00244 {51, 3, 5, 5, 8 },
00245 {52, 2, 5, 20, 5 },
00246 {53, 3, 5, 4, 8 },
00247 {54, 3, 5, 3, 8 },
00248 {55, 3, 5, 5, 4 },
00249 {56, 2, 5, 24, 5 },
00250 {57, 3, 5, 2, 8 },
00251 {58, 3, 5, 1, 8 },
00252 {59, 3, 5, 4, 4 },
00253 {60, 3, 5, 0, 8 },
00254 {61, 3, 5, 3, 4 },
00255 {62, 3, 5, 2, 4 },
00256 {63, 3, 5, 1, 1 },
00257 };
00258 #endif
00259
00260
00261 const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = {
00262 { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2},
00263 { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0},
00264 { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0},
00265 { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10}
00266 };
00267 const uint8_t ff_vc1_4mv_block_pattern_bits[4][16] = {
00268 { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
00269 { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
00270 { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
00271 { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
00272 };
00273
00274 const uint8_t wmv3_dc_scale_table[32]={
00275 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
00276 };
00277
00278
00279 #if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
00280 const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
00281 {
00282 0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119,
00283 1, 54, 96, 8, 10, 111, 5, 15, 12, 10, 2, 12, 13, 115, 53, 63,
00284 1, 7, 1, 7, 14, 12, 4, 14, 1, 9, 97, 11, 7, 58, 52, 62,
00285 4, 103, 1, 9, 11, 56, 101, 118, 4, 110, 100, 30, 2, 5, 4, 3
00286 },
00287 {
00288 0, 9, 1, 18, 5, 14, 237, 26, 3, 121, 3, 22, 13, 16, 6, 30,
00289 2, 10, 1, 20, 12, 241, 5, 28, 16, 12, 3, 24, 28, 124, 239, 247,
00290 1, 240, 1, 19, 18, 15, 4, 27, 1, 122, 2, 23, 1, 17, 7, 31,
00291 1, 11, 2, 21, 19, 246, 238, 29, 17, 13, 236, 25, 58, 63, 8, 125
00292 },
00293 {
00294 0, 201, 25, 231, 5, 221, 1, 3, 2, 414, 2, 241, 16, 225, 195, 492,
00295 2, 412, 1, 240, 7, 224, 98, 245, 1, 220, 96, 5, 9, 230, 101, 247,
00296 1, 102, 1, 415, 24, 3, 2, 244, 3, 54, 3, 484, 17, 114, 200, 493,
00297 3, 413, 1, 4, 13, 113, 99, 485, 4, 111, 194, 243, 5, 29, 26, 31
00298 },
00299 {
00300 0, 28, 12, 44, 3, 36, 20, 52, 2, 32, 16, 48, 8, 40, 24, 28,
00301 1, 30, 14, 46, 6, 38, 22, 54, 3, 34, 18, 50, 10, 42, 26, 30,
00302 1, 29, 13, 45, 5, 37, 21, 53, 2, 33, 17, 49, 9, 41, 25, 29,
00303 1, 31, 15, 47, 7, 39, 23, 55, 4, 35, 19, 51, 11, 43, 27, 31
00304 }
00305 };
00306
00307 const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
00308 {
00309 13, 13, 7, 13, 7, 13, 13, 12, 6, 13, 7, 12, 6, 8, 8, 8,
00310 5, 7, 8, 12, 6, 8, 13, 12, 7, 13, 13, 12, 6, 8, 7, 7,
00311 6, 13, 8, 12, 7, 13, 13, 12, 7, 13, 8, 12, 5, 7, 7, 7,
00312 6, 8, 13, 12, 6, 7, 8, 8, 5, 8, 8, 6, 3, 3, 3, 2
00313 },
00314 {
00315 14, 13, 8, 13, 3, 13, 8, 13, 3, 7, 8, 13, 4, 13, 13, 13,
00316 3, 13, 13, 13, 4, 8, 13, 13, 5, 13, 13, 13, 5, 7, 8, 8,
00317 3, 8, 14, 13, 5, 13, 13, 13, 4, 7, 13, 13, 6, 13, 13, 13,
00318 5, 13, 8, 13, 5, 8, 8, 13, 5, 13, 8, 13, 6, 6, 13, 7
00319 },
00320 {
00321 13, 8, 6, 8, 4, 8, 13, 12, 4, 9, 8, 8, 5, 8, 8, 9,
00322 5, 9, 10, 8, 4, 8, 7, 8, 6, 8, 7, 13, 4, 8, 7, 8,
00323 5, 7, 8, 9, 6, 13, 13, 8, 4, 6, 8, 9, 5, 7, 8, 9,
00324 5, 9, 9, 13, 5, 7, 7, 9, 4, 7, 8, 8, 3, 5, 5, 5
00325 },
00326 {
00327 9, 9, 9, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 8,
00328 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
00329 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
00330 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8
00331 }
00332 };
00333 #else
00334 const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
00335 {
00336 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
00337 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
00338 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5,
00339 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3
00340 },
00341 {
00342 0, 1, 2, 1, 3, 1, 16, 17, 5, 18, 12, 19, 13, 1, 28, 58,
00343 1, 1, 1, 2, 3, 2, 3, 236, 237, 4, 5, 238, 6, 7, 239, 8,
00344 9, 240, 10, 11, 121, 122, 12, 13, 14, 15, 241, 246, 16, 17, 124, 63,
00345 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 247, 125
00346 },
00347 {
00348 0, 1, 2, 3, 2, 3, 1, 4, 5, 24, 7, 13, 16, 17, 9, 5,
00349 25, 1, 1, 1, 2, 3, 96, 194, 1, 2, 98, 99, 195, 200, 101, 26,
00350 201, 102, 412, 413, 414, 54, 220, 111, 221, 3, 224, 113, 225, 114, 230, 29,
00351 231, 415, 240, 4, 241, 484, 5, 243, 3, 244, 245, 485, 492, 493, 247, 31
00352 },
00353 {
00354 0, 1, 1, 1, 2, 2, 3, 4, 3, 5, 6, 7, 8, 9, 10, 11,
00355 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
00356 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
00357 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
00358 }
00359 };
00360 const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
00361 {
00362 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
00363 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
00364 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3,
00365 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2
00366 },
00367 {
00368 14, 3, 3, 5, 3, 4, 5, 5, 3, 5, 4, 5, 4, 6, 5, 6,
00369 8, 14, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 13, 13, 8, 13,
00370 13, 8, 13, 13, 7, 7, 13, 13, 13, 13, 8, 8, 13, 13, 7, 6,
00371 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 7
00372 },
00373 {
00374 13, 5, 5, 5, 4, 4, 6, 4, 4, 6, 4, 5, 5, 5, 4, 3,
00375 6, 8, 10, 9, 8, 8, 7, 8, 13, 13, 7, 7, 8, 8, 7, 5,
00376 8, 7, 9, 9, 9, 6, 8, 7, 8, 13, 8, 7, 8, 7, 8, 5,
00377 8, 9, 8, 13, 8, 9, 13, 8, 12, 8, 8, 9, 9, 9, 8, 5
00378 },
00379 {
00380 9, 2, 3, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9,
00381 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
00382 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
00383 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8
00384 }
00385 };
00386 #endif
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396 const uint16_t ff_vc1_ttmb_codes[3][16] = {
00397 {
00398 0x0003,
00399 0x002E, 0x005F, 0x0000,
00400 0x0016, 0x0015, 0x0001,
00401 0x0004, 0x0014,
00402 0x02F1, 0x0179, 0x017B,
00403 0x0BC0, 0x0BC1, 0x05E1,
00404 0x017A
00405 },
00406 {
00407 0x0006,
00408 0x0006, 0x0003, 0x0007,
00409 0x000F, 0x000E, 0x0000,
00410 0x0002, 0x0002,
00411 0x0014, 0x0011, 0x000B,
00412 0x0009, 0x0021, 0x0015,
00413 0x0020
00414 },
00415 {
00416 0x0006,
00417 0x0000, 0x000E, 0x0005,
00418 0x0002, 0x0003, 0x0003,
00419 0x000F, 0x0002,
00420 0x0081, 0x0021, 0x0009,
00421 0x0101, 0x0041, 0x0011,
00422 0x0100
00423 }
00424 };
00425
00426 const uint8_t ff_vc1_ttmb_bits[3][16] = {
00427 {
00428 2,
00429 6, 7, 2,
00430 5, 5, 2,
00431 3, 5,
00432 10, 9, 9,
00433 12, 12, 11,
00434 9
00435 },
00436 {
00437 3,
00438 4, 4, 4,
00439 4, 4, 3,
00440 3, 2,
00441 7, 7, 6,
00442 6, 8, 7,
00443 8
00444 },
00445 {
00446 3,
00447 3, 4, 5,
00448 3, 3, 4,
00449 4, 2,
00450 10, 8, 6,
00451 11, 9, 7,
00452 11
00453 }
00454 };
00455
00456
00457 const uint8_t ff_vc1_ttblk_codes[3][8] = {
00458 { 0, 1, 3, 5, 16, 17, 18, 19},
00459 { 3, 0, 1, 2, 3, 5, 8, 9},
00460 { 1, 0, 1, 4, 6, 7, 10, 11}
00461 };
00462 const uint8_t ff_vc1_ttblk_bits[3][8] = {
00463 { 2, 2, 2, 3, 5, 5, 5, 5},
00464 { 2, 3, 3, 3, 3, 3, 4, 4},
00465 { 2, 3, 3, 3, 3, 3, 4, 4}
00466 };
00467
00468
00469 const uint8_t ff_vc1_subblkpat_codes[3][15] = {
00470 { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1},
00471 { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1},
00472 { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15}
00473 };
00474 const uint8_t ff_vc1_subblkpat_bits[3][15] = {
00475 { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1},
00476 { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2},
00477 { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4}
00478 };
00479
00480
00481 const uint16_t ff_vc1_mv_diff_codes[4][73] = {
00482 {
00483 0, 2, 3, 8, 576, 3, 2, 6,
00484 5, 577, 578, 7, 8, 9, 40, 19,
00485 37, 82, 21, 22, 23, 579, 580, 166,
00486 96, 167, 49, 194, 195, 581, 582, 583,
00487 292, 293, 294, 13, 2, 7, 24, 50,
00488 102, 295, 13, 7, 8, 18, 50, 103,
00489 38, 20, 21, 22, 39, 204, 103, 23,
00490 24, 25, 104, 410, 105, 106, 107, 108,
00491 109, 220, 411, 442, 222, 443, 446, 447,
00492 7
00493 },
00494 {
00495 0, 4, 5, 3, 4, 3, 4, 5,
00496 20, 6, 21, 44, 45, 46, 3008, 95,
00497 112, 113, 57, 3009, 3010, 116, 117, 3011,
00498 118, 3012, 3013, 3014, 3015, 3016, 3017, 3018,
00499 3019, 3020, 3021, 3022, 1, 4, 15, 160,
00500 161, 41, 6, 11, 42, 162, 43, 119,
00501 56, 57, 58, 163, 236, 237, 3023, 119,
00502 120, 242, 122, 486, 1512, 487, 246, 494,
00503 1513, 495, 1514, 1515, 1516, 1517, 1518, 1519,
00504 31
00505 },
00506 {
00507 0, 512, 513, 514, 515, 2, 3, 258,
00508 259, 260, 261, 262, 263, 264, 265, 266,
00509 267, 268, 269, 270, 271, 272, 273, 274,
00510 275, 276, 277, 278, 279, 280, 281, 282,
00511 283, 284, 285, 286, 1, 5, 287, 288,
00512 289, 290, 6, 7, 291, 292, 293, 294,
00513 295, 296, 297, 298, 299, 300, 301, 302,
00514 303, 304, 305, 306, 307, 308, 309, 310,
00515 311, 312, 313, 314, 315, 316, 317, 318,
00516 319
00517 },
00518 {
00519 0, 1, 1, 2, 3, 4, 1, 5,
00520 4, 3, 5, 8, 6, 9, 10, 11,
00521 12, 7, 104, 14, 105, 4, 10, 15,
00522 11, 6, 14, 8, 106, 107, 108, 15,
00523 109, 9, 55, 10, 1, 2, 1, 2,
00524 3, 12, 6, 2, 6, 7, 28, 7,
00525 15, 8, 5, 18, 29, 152, 77, 24,
00526 25, 26, 39, 108, 13, 109, 55, 56,
00527 57, 116, 11, 153, 234, 235, 118, 119,
00528 15
00529 }
00530 };
00531 const uint8_t ff_vc1_mv_diff_bits[4][73] = {
00532 {
00533 6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9,
00534 10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14,
00535 13, 13, 13, 6, 3, 5, 6, 8, 9, 13, 5, 4, 4, 5, 7, 9,
00536 6, 5, 5, 5, 6, 9, 8, 5, 5, 5, 7, 10, 7, 7, 7, 7,
00537 7, 8, 10, 9, 8, 9, 9, 9, 3
00538 },
00539 {
00540 5, 7, 7, 6, 6, 5, 5, 6, 7, 5, 7, 8, 8, 8, 14, 9,
00541 9, 9, 8, 14, 14, 9, 9, 14, 9, 14, 14, 14, 14, 14, 14, 14,
00542 14, 14, 14, 14, 2, 3, 6, 8, 8, 6, 3, 4, 6, 8, 6, 9,
00543 6, 6, 6, 8, 8, 8, 14, 7, 7, 8, 7, 9, 13, 9, 8, 9,
00544 13, 9, 13, 13, 13, 13, 13, 13, 5
00545
00546 },
00547 {
00548 3, 12, 12, 12, 12, 3, 4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
00549 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
00550 11, 11, 11, 11, 1, 5, 11, 11, 11, 11, 4, 4, 11, 11, 11, 11,
00551 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
00552 11, 11, 11, 11, 11, 11, 11, 11, 11
00553 },
00554 {
00555 15, 11, 15, 15, 15, 15, 12, 15, 12, 11, 12, 12, 15, 12, 12, 12,
00556 12, 15, 15, 12, 15, 10, 11, 12, 11, 10, 11, 10, 15, 15, 15, 11,
00557 15, 10, 14, 10, 4, 4, 5, 7, 8, 9, 5, 3, 4, 5, 6, 8,
00558 5, 4, 3, 5, 6, 8, 7, 5, 5, 5, 6, 7, 9, 7, 6, 6,
00559 6, 7, 10, 8, 8, 8, 7, 7, 4
00560 }
00561 };
00562
00563
00564
00565
00566 const int8_t ff_vc1_simple_progressive_4x4_zz [16] =
00567 {
00568 0, 8, 16, 1,
00569 9, 24, 17, 2,
00570 10, 18, 25, 3,
00571 11, 26, 19, 27
00572 };
00573
00574 const int8_t ff_vc1_adv_progressive_8x4_zz [32] =
00575 {
00576 0, 8, 1, 16, 2, 9, 10, 3,
00577 24, 17, 4, 11, 18, 12, 5, 19,
00578 25, 13, 20, 26, 27, 6, 21, 28,
00579 14, 22, 29, 7, 30, 15, 23, 31
00580 };
00581
00582 const int8_t ff_vc1_adv_progressive_4x8_zz [32] =
00583 {
00584 0, 1, 8, 2,
00585 9, 16, 17, 24,
00586 10, 32, 25, 18,
00587 40, 3, 33, 26,
00588 48, 11, 56, 41,
00589 34, 49, 57, 42,
00590 19, 50, 27, 58,
00591 35, 43, 51, 59
00592 };
00593
00594 const int8_t ff_vc1_adv_interlaced_8x8_zz [64] =
00595 {
00596 0, 8, 1, 16, 24, 9, 2, 32,
00597 40, 48, 56, 17, 10, 3, 25, 18,
00598 11, 4, 33, 41, 49, 57, 26, 34,
00599 42, 50, 58, 19, 12, 5, 27, 20,
00600 13, 6, 35, 28, 21, 14, 7, 15,
00601 22, 29, 36, 43, 51, 59, 60, 52,
00602 44, 37, 30, 23, 31, 38, 45, 53,
00603 61, 62, 54, 46, 39, 47, 55, 63
00604 };
00605
00606 const int8_t ff_vc1_adv_interlaced_8x4_zz [32] =
00607 {
00608 0, 8, 16, 24, 1, 9, 2, 17,
00609 25, 10, 3, 18, 26, 4, 11, 19,
00610 12, 5, 13, 20, 27, 6, 21, 28,
00611 14, 22, 29, 7, 30, 15, 23, 31
00612 };
00613
00614 const int8_t ff_vc1_adv_interlaced_4x8_zz [32] =
00615 {
00616 0, 1, 2, 8,
00617 16, 9, 24, 17,
00618 10, 3, 32, 40,
00619 48, 56, 25, 18,
00620 33, 26, 41, 34,
00621 49, 57, 11, 42,
00622 19, 50, 27, 58,
00623 35, 43, 51, 59
00624 };
00625
00626 const int8_t ff_vc1_adv_interlaced_4x4_zz [16] =
00627 {
00628 0, 8, 16, 24,
00629 1, 9, 17, 2,
00630 25, 10, 18, 3,
00631 26, 11, 19, 27
00632 };
00633
00634
00635
00636 const int32_t ff_vc1_dqscale[63] = {
00637 0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
00638 0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000,
00639 0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB,
00640 0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000,
00641 0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A,
00642 0x18FA, 0x1862, 0x17D0, 0x1746, 0x16C1, 0x1643, 0x15CA, 0x1555,
00643 0x14E6, 0x147B, 0x1414, 0x13B1, 0x1352, 0x12F7, 0x129E, 0x1249,
00644 0x11F7, 0x11A8, 0x115B, 0x1111, 0x10C9, 0x1084, 0x1000
00645 };