Mercurial > libavcodec.hg
comparison msmpeg4data.h @ 936:caa77cd960c0 libavcodec
qpel encoding
4mv+b frames encoding finally fixed
chroma ME
5 comparission functions for ME
b frame encoding speedup
wmv2 codec (unfinished)
user specified diamond size for EPZS
| author | michaelni |
|---|---|
| date | Fri, 27 Dec 2002 23:51:46 +0000 |
| parents | e65798d228ea |
| children | 5d4c95f323d0 |
comparison
equal
deleted
inserted
replaced
| 935:c9bbd35064b6 | 936:caa77cd960c0 |
|---|---|
| 1 /* | 1 /* |
| 2 * MSMPEG4 data tables. | 2 * MSMPEG4 data tables. |
| 3 */ | 3 */ |
| 4 | 4 |
| 5 /* intra picture macro block coded block pattern */ | 5 /* intra picture macro block coded block pattern */ |
| 6 static const UINT16 table_mb_intra[64][2] = { | 6 static const uint16_t table_mb_intra[64][2] = { |
| 7 { 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 }, | 7 { 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 }, |
| 8 { 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 }, | 8 { 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 }, |
| 9 { 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 }, | 9 { 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 }, |
| 10 { 0x2, 6 },{ 0xec, 9 },{ 0x77, 8 },{ 0x0, 8 }, | 10 { 0x2, 6 },{ 0xec, 9 },{ 0x77, 8 },{ 0x0, 8 }, |
| 11 { 0x3, 5 },{ 0xb7, 9 },{ 0x2c, 7 },{ 0x13, 7 }, | 11 { 0x3, 5 },{ 0xb7, 9 },{ 0x2c, 7 },{ 0x13, 7 }, |
| 21 { 0x15, 6 },{ 0x1db, 10 },{ 0x2, 9 },{ 0x46, 9 }, | 21 { 0x15, 6 },{ 0x1db, 10 },{ 0x2, 9 },{ 0x46, 9 }, |
| 22 { 0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 }, | 22 { 0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 }, |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 /* non intra picture macro block coded block pattern + mb type */ | 25 /* non intra picture macro block coded block pattern + mb type */ |
| 26 static const UINT32 table_mb_non_intra[128][2] = { | 26 static const uint32_t table_mb_non_intra[128][2] = { |
| 27 { 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 }, | 27 { 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 }, |
| 28 { 0x9fc, 12 },{ 0xa83, 18 },{ 0x12d34, 17 },{ 0x83bc, 16 }, | 28 { 0x9fc, 12 },{ 0xa83, 18 },{ 0x12d34, 17 },{ 0x83bc, 16 }, |
| 29 { 0x83a, 12 },{ 0x7f8, 17 },{ 0x3fd, 16 },{ 0x3ff, 16 }, | 29 { 0x83a, 12 },{ 0x7f8, 17 },{ 0x3fd, 16 },{ 0x3ff, 16 }, |
| 30 { 0x79, 13 },{ 0xa82, 18 },{ 0x969d, 16 },{ 0x2a4, 16 }, | 30 { 0x79, 13 },{ 0xa82, 18 },{ 0x969d, 16 },{ 0x2a4, 16 }, |
| 31 { 0x978, 12 },{ 0x543, 17 },{ 0x41df, 15 },{ 0x7f9, 17 }, | 31 { 0x978, 12 },{ 0x543, 17 },{ 0x41df, 15 },{ 0x7f9, 17 }, |
| 58 { 0x5, 5 },{ 0xb, 10 },{ 0x9c, 8 },{ 0xe, 10 }, | 58 { 0x5, 5 },{ 0xb, 10 },{ 0x9c, 8 },{ 0xe, 10 }, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 /* dc table 0 */ | 61 /* dc table 0 */ |
| 62 | 62 |
| 63 static const UINT32 table0_dc_lum[120][2] = { | 63 static const uint32_t table0_dc_lum[120][2] = { |
| 64 { 0x1, 1 },{ 0x1, 2 },{ 0x1, 4 },{ 0x1, 5 }, | 64 { 0x1, 1 },{ 0x1, 2 },{ 0x1, 4 },{ 0x1, 5 }, |
| 65 { 0x5, 5 },{ 0x7, 5 },{ 0x8, 6 },{ 0xc, 6 }, | 65 { 0x5, 5 },{ 0x7, 5 },{ 0x8, 6 },{ 0xc, 6 }, |
| 66 { 0x0, 7 },{ 0x2, 7 },{ 0x12, 7 },{ 0x1a, 7 }, | 66 { 0x0, 7 },{ 0x2, 7 },{ 0x12, 7 },{ 0x1a, 7 }, |
| 67 { 0x3, 8 },{ 0x7, 8 },{ 0x27, 8 },{ 0x37, 8 }, | 67 { 0x3, 8 },{ 0x7, 8 },{ 0x27, 8 },{ 0x37, 8 }, |
| 68 { 0x5, 9 },{ 0x4c, 9 },{ 0x6c, 9 },{ 0x6d, 9 }, | 68 { 0x5, 9 },{ 0x4c, 9 },{ 0x6c, 9 },{ 0x6d, 9 }, |
| 91 { 0x60784, 24 },{ 0x60785, 24 },{ 0x60786, 24 },{ 0x60787, 24 }, | 91 { 0x60784, 24 },{ 0x60785, 24 },{ 0x60786, 24 },{ 0x60787, 24 }, |
| 92 { 0x60788, 24 },{ 0x60789, 24 },{ 0x6078a, 24 },{ 0x6078b, 24 }, | 92 { 0x60788, 24 },{ 0x60789, 24 },{ 0x6078a, 24 },{ 0x6078b, 24 }, |
| 93 { 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 }, | 93 { 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 }, |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 static const UINT32 table0_dc_chroma[120][2] = { | 96 static const uint32_t table0_dc_chroma[120][2] = { |
| 97 { 0x0, 2 },{ 0x1, 2 },{ 0x5, 3 },{ 0x9, 4 }, | 97 { 0x0, 2 },{ 0x1, 2 },{ 0x5, 3 },{ 0x9, 4 }, |
| 98 { 0xd, 4 },{ 0x11, 5 },{ 0x1d, 5 },{ 0x1f, 5 }, | 98 { 0xd, 4 },{ 0x11, 5 },{ 0x1d, 5 },{ 0x1f, 5 }, |
| 99 { 0x21, 6 },{ 0x31, 6 },{ 0x38, 6 },{ 0x33, 6 }, | 99 { 0x21, 6 },{ 0x31, 6 },{ 0x38, 6 },{ 0x33, 6 }, |
| 100 { 0x39, 6 },{ 0x3d, 6 },{ 0x61, 7 },{ 0x79, 7 }, | 100 { 0x39, 6 },{ 0x3d, 6 },{ 0x61, 7 },{ 0x79, 7 }, |
| 101 { 0x80, 8 },{ 0xc8, 8 },{ 0xca, 8 },{ 0xf0, 8 }, | 101 { 0x80, 8 },{ 0xc8, 8 },{ 0xca, 8 },{ 0xf0, 8 }, |
| 126 { 0x60888c, 23 },{ 0x60888d, 23 },{ 0x60888e, 23 },{ 0x60888f, 23 }, | 126 { 0x60888c, 23 },{ 0x60888d, 23 },{ 0x60888e, 23 },{ 0x60888f, 23 }, |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 /* dc table 1 */ | 129 /* dc table 1 */ |
| 130 | 130 |
| 131 static const UINT32 table1_dc_lum[120][2] = { | 131 static const uint32_t table1_dc_lum[120][2] = { |
| 132 { 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 }, | 132 { 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 }, |
| 133 { 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 }, | 133 { 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 }, |
| 134 { 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 }, | 134 { 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 }, |
| 135 { 0x13, 6 },{ 0x8, 7 },{ 0x18, 7 },{ 0x1c, 7 }, | 135 { 0x13, 6 },{ 0x8, 7 },{ 0x18, 7 },{ 0x1c, 7 }, |
| 136 { 0x24, 7 },{ 0x4, 8 },{ 0x6, 8 },{ 0x12, 8 }, | 136 { 0x24, 7 },{ 0x4, 8 },{ 0x6, 8 },{ 0x12, 8 }, |
| 159 { 0x1e695c, 26 },{ 0x1e695d, 26 },{ 0x1e695e, 26 },{ 0x1e695f, 26 }, | 159 { 0x1e695c, 26 },{ 0x1e695d, 26 },{ 0x1e695e, 26 },{ 0x1e695f, 26 }, |
| 160 { 0x1e6960, 26 },{ 0x1e6961, 26 },{ 0x1e6962, 26 },{ 0x1e6963, 26 }, | 160 { 0x1e6960, 26 },{ 0x1e6961, 26 },{ 0x1e6962, 26 },{ 0x1e6963, 26 }, |
| 161 { 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 }, | 161 { 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 }, |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 static const UINT32 table1_dc_chroma[120][2] = { | 164 static const uint32_t table1_dc_chroma[120][2] = { |
| 165 { 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 }, | 165 { 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 }, |
| 166 { 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 }, | 166 { 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 }, |
| 167 { 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 }, | 167 { 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 }, |
| 168 { 0x66, 7 },{ 0xa6, 8 },{ 0xc6, 8 },{ 0xcf, 8 }, | 168 { 0x66, 7 },{ 0xa6, 8 },{ 0xc6, 8 },{ 0xcf, 8 }, |
| 169 { 0x14f, 9 },{ 0x18e, 9 },{ 0x19c, 9 },{ 0x29d, 10 }, | 169 { 0x14f, 9 },{ 0x18e, 9 },{ 0x19c, 9 },{ 0x29d, 10 }, |
| 194 { 0x18f648c, 25 },{ 0x18f648d, 25 },{ 0x18f648e, 25 },{ 0x18f648f, 25 }, | 194 { 0x18f648c, 25 },{ 0x18f648d, 25 },{ 0x18f648e, 25 },{ 0x18f648f, 25 }, |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 /* vlc table 0, for intra luma */ | 197 /* vlc table 0, for intra luma */ |
| 198 | 198 |
| 199 static const UINT16 table0_vlc[133][2] = { | 199 static const uint16_t table0_vlc[133][2] = { |
| 200 { 0x1, 2 },{ 0x6, 3 },{ 0xf, 4 },{ 0x16, 5 }, | 200 { 0x1, 2 },{ 0x6, 3 },{ 0xf, 4 },{ 0x16, 5 }, |
| 201 { 0x20, 6 },{ 0x18, 7 },{ 0x8, 8 },{ 0x9a, 8 }, | 201 { 0x20, 6 },{ 0x18, 7 },{ 0x8, 8 },{ 0x9a, 8 }, |
| 202 { 0x56, 9 },{ 0x13e, 9 },{ 0xf0, 10 },{ 0x3a5, 10 }, | 202 { 0x56, 9 },{ 0x13e, 9 },{ 0xf0, 10 },{ 0x3a5, 10 }, |
| 203 { 0x77, 11 },{ 0x1ef, 11 },{ 0x9a, 12 },{ 0x5d, 13 }, | 203 { 0x77, 11 },{ 0x1ef, 11 },{ 0x9a, 12 },{ 0x5d, 13 }, |
| 204 { 0x1, 4 },{ 0x11, 5 },{ 0x2, 7 },{ 0xb, 8 }, | 204 { 0x1, 4 },{ 0x11, 5 },{ 0x2, 7 },{ 0xb, 8 }, |
| 231 { 0x74, 11 },{ 0xeb, 12 },{ 0x2f9, 12 },{ 0x5c, 13 }, | 231 { 0x74, 11 },{ 0xeb, 12 },{ 0x2f9, 12 },{ 0x5c, 13 }, |
| 232 { 0xed, 12 },{ 0x3dd, 12 },{ 0x326, 12 },{ 0x5e, 13 }, | 232 { 0xed, 12 },{ 0x3dd, 12 },{ 0x326, 12 },{ 0x5e, 13 }, |
| 233 { 0x16, 7 }, | 233 { 0x16, 7 }, |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 static const INT8 table0_level[132] = { | 236 static const int8_t table0_level[132] = { |
| 237 1, 2, 3, 4, 5, 6, 7, 8, | 237 1, 2, 3, 4, 5, 6, 7, 8, |
| 238 9, 10, 11, 12, 13, 14, 15, 16, | 238 9, 10, 11, 12, 13, 14, 15, 16, |
| 239 1, 2, 3, 4, 5, 6, 7, 8, | 239 1, 2, 3, 4, 5, 6, 7, 8, |
| 240 9, 10, 11, 1, 2, 3, 4, 5, | 240 9, 10, 11, 1, 2, 3, 4, 5, |
| 241 6, 7, 8, 1, 2, 3, 4, 5, | 241 6, 7, 8, 1, 2, 3, 4, 5, |
| 251 2, 1, 2, 1, 2, 1, 2, 1, | 251 2, 1, 2, 1, 2, 1, 2, 1, |
| 252 1, 1, 1, 1, 1, 1, 1, 1, | 252 1, 1, 1, 1, 1, 1, 1, 1, |
| 253 1, 1, 1, 1, | 253 1, 1, 1, 1, |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 static const INT8 table0_run[132] = { | 256 static const int8_t table0_run[132] = { |
| 257 0, 0, 0, 0, 0, 0, 0, 0, | 257 0, 0, 0, 0, 0, 0, 0, 0, |
| 258 0, 0, 0, 0, 0, 0, 0, 0, | 258 0, 0, 0, 0, 0, 0, 0, 0, |
| 259 1, 1, 1, 1, 1, 1, 1, 1, | 259 1, 1, 1, 1, 1, 1, 1, 1, |
| 260 1, 1, 1, 2, 2, 2, 2, 2, | 260 1, 1, 1, 2, 2, 2, 2, 2, |
| 261 2, 2, 2, 3, 3, 3, 3, 3, | 261 2, 2, 2, 3, 3, 3, 3, 3, |
| 273 23, 24, 25, 26, | 273 23, 24, 25, 26, |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 /* vlc table 1, for intra chroma and P macro blocks */ | 276 /* vlc table 1, for intra chroma and P macro blocks */ |
| 277 | 277 |
| 278 static const UINT16 table1_vlc[149][2] = { | 278 static const uint16_t table1_vlc[149][2] = { |
| 279 { 0x4, 3 },{ 0x14, 5 },{ 0x17, 7 },{ 0x7f, 8 }, | 279 { 0x4, 3 },{ 0x14, 5 },{ 0x17, 7 },{ 0x7f, 8 }, |
| 280 { 0x154, 9 },{ 0x1f2, 10 },{ 0xbf, 11 },{ 0x65, 12 }, | 280 { 0x154, 9 },{ 0x1f2, 10 },{ 0xbf, 11 },{ 0x65, 12 }, |
| 281 { 0xaaa, 12 },{ 0x630, 13 },{ 0x1597, 13 },{ 0x3b7, 14 }, | 281 { 0xaaa, 12 },{ 0x630, 13 },{ 0x1597, 13 },{ 0x3b7, 14 }, |
| 282 { 0x2b22, 14 },{ 0xbe6, 15 },{ 0xb, 4 },{ 0x37, 7 }, | 282 { 0x2b22, 14 },{ 0xbe6, 15 },{ 0xb, 4 },{ 0x37, 7 }, |
| 283 { 0x62, 9 },{ 0x7, 11 },{ 0x166, 12 },{ 0xce, 13 }, | 283 { 0x62, 9 },{ 0x7, 11 },{ 0x166, 12 },{ 0xce, 13 }, |
| 314 { 0x1557, 13 },{ 0x59d, 14 },{ 0x2aa3, 14 },{ 0x2b2a, 14 }, | 314 { 0x1557, 13 },{ 0x59d, 14 },{ 0x2aa3, 14 },{ 0x2b2a, 14 }, |
| 315 { 0x1de, 14 },{ 0x63c, 13 },{ 0xcf, 13 },{ 0x1594, 13 }, | 315 { 0x1de, 14 },{ 0x63c, 13 },{ 0xcf, 13 },{ 0x1594, 13 }, |
| 316 { 0xd, 9 }, | 316 { 0xd, 9 }, |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 static const INT8 table1_level[148] = { | 319 static const int8_t table1_level[148] = { |
| 320 1, 2, 3, 4, 5, 6, 7, 8, | 320 1, 2, 3, 4, 5, 6, 7, 8, |
| 321 9, 10, 11, 12, 13, 14, 1, 2, | 321 9, 10, 11, 12, 13, 14, 1, 2, |
| 322 3, 4, 5, 6, 7, 8, 9, 1, | 322 3, 4, 5, 6, 7, 8, 9, 1, |
| 323 2, 3, 4, 5, 1, 2, 3, 4, | 323 2, 3, 4, 5, 1, 2, 3, 4, |
| 324 1, 2, 3, 4, 1, 2, 3, 4, | 324 1, 2, 3, 4, 1, 2, 3, 4, |
| 336 1, 1, 1, 1, 1, 1, 1, 1, | 336 1, 1, 1, 1, 1, 1, 1, 1, |
| 337 1, 1, 1, 1, 1, 1, 1, 1, | 337 1, 1, 1, 1, 1, 1, 1, 1, |
| 338 1, 1, 1, 1, | 338 1, 1, 1, 1, |
| 339 }; | 339 }; |
| 340 | 340 |
| 341 static const INT8 table1_run[148] = { | 341 static const int8_t table1_run[148] = { |
| 342 0, 0, 0, 0, 0, 0, 0, 0, | 342 0, 0, 0, 0, 0, 0, 0, 0, |
| 343 0, 0, 0, 0, 0, 0, 1, 1, | 343 0, 0, 0, 0, 0, 0, 1, 1, |
| 344 1, 1, 1, 1, 1, 1, 1, 2, | 344 1, 1, 1, 1, 1, 1, 1, 2, |
| 345 2, 2, 2, 2, 3, 3, 3, 3, | 345 2, 2, 2, 2, 3, 3, 3, 3, |
| 346 4, 4, 4, 4, 5, 5, 5, 5, | 346 4, 4, 4, 4, 5, 5, 5, 5, |
| 360 40, 41, 42, 43, | 360 40, 41, 42, 43, |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 /* third vlc table */ | 363 /* third vlc table */ |
| 364 | 364 |
| 365 static const UINT16 table2_vlc[186][2] = { | 365 static const uint16_t table2_vlc[186][2] = { |
| 366 { 0x1, 2 },{ 0x5, 3 },{ 0xd, 4 },{ 0x12, 5 }, | 366 { 0x1, 2 },{ 0x5, 3 },{ 0xd, 4 },{ 0x12, 5 }, |
| 367 { 0xe, 6 },{ 0x15, 7 },{ 0x13, 8 },{ 0x3f, 8 }, | 367 { 0xe, 6 },{ 0x15, 7 },{ 0x13, 8 },{ 0x3f, 8 }, |
| 368 { 0x4b, 9 },{ 0x11f, 9 },{ 0xb8, 10 },{ 0x3e3, 10 }, | 368 { 0x4b, 9 },{ 0x11f, 9 },{ 0xb8, 10 },{ 0x3e3, 10 }, |
| 369 { 0x172, 11 },{ 0x24d, 12 },{ 0x3da, 12 },{ 0x2dd, 13 }, | 369 { 0x172, 11 },{ 0x24d, 12 },{ 0x3da, 12 },{ 0x2dd, 13 }, |
| 370 { 0x1f55, 13 },{ 0x5b9, 14 },{ 0x3eae, 14 },{ 0x0, 4 }, | 370 { 0x1f55, 13 },{ 0x5b9, 14 },{ 0x3eae, 14 },{ 0x0, 4 }, |
| 410 { 0x3d8, 12 },{ 0x78e, 13 },{ 0x2d5, 13 },{ 0x1f5e, 13 }, | 410 { 0x3d8, 12 },{ 0x78e, 13 },{ 0x2d5, 13 },{ 0x1f5e, 13 }, |
| 411 { 0x1f2b, 13 },{ 0x78f, 13 },{ 0x4ad, 14 },{ 0x3eaf, 14 }, | 411 { 0x1f2b, 13 },{ 0x78f, 13 },{ 0x4ad, 14 },{ 0x3eaf, 14 }, |
| 412 { 0x23dc, 14 },{ 0x4a, 9 }, | 412 { 0x23dc, 14 },{ 0x4a, 9 }, |
| 413 }; | 413 }; |
| 414 | 414 |
| 415 static const INT8 table2_level[185] = { | 415 static const int8_t table2_level[185] = { |
| 416 1, 2, 3, 4, 5, 6, 7, 8, | 416 1, 2, 3, 4, 5, 6, 7, 8, |
| 417 9, 10, 11, 12, 13, 14, 15, 16, | 417 9, 10, 11, 12, 13, 14, 15, 16, |
| 418 17, 18, 19, 1, 2, 3, 4, 5, | 418 17, 18, 19, 1, 2, 3, 4, 5, |
| 419 6, 7, 8, 9, 10, 11, 12, 13, | 419 6, 7, 8, 9, 10, 11, 12, 13, |
| 420 14, 15, 1, 2, 3, 4, 5, 6, | 420 14, 15, 1, 2, 3, 4, 5, 6, |
| 437 1, 1, 1, 1, 1, 1, 1, 1, | 437 1, 1, 1, 1, 1, 1, 1, 1, |
| 438 1, 1, 1, 1, 1, 1, 1, 1, | 438 1, 1, 1, 1, 1, 1, 1, 1, |
| 439 1, | 439 1, |
| 440 }; | 440 }; |
| 441 | 441 |
| 442 static const INT8 table2_run[185] = { | 442 static const int8_t table2_run[185] = { |
| 443 0, 0, 0, 0, 0, 0, 0, 0, | 443 0, 0, 0, 0, 0, 0, 0, 0, |
| 444 0, 0, 0, 0, 0, 0, 0, 0, | 444 0, 0, 0, 0, 0, 0, 0, 0, |
| 445 0, 0, 0, 1, 1, 1, 1, 1, | 445 0, 0, 0, 1, 1, 1, 1, 1, |
| 446 1, 1, 1, 1, 1, 1, 1, 1, | 446 1, 1, 1, 1, 1, 1, 1, 1, |
| 447 1, 1, 2, 2, 2, 2, 2, 2, | 447 1, 1, 2, 2, 2, 2, 2, 2, |
| 465 29, 30, 31, 32, 33, 34, 35, 36, | 465 29, 30, 31, 32, 33, 34, 35, 36, |
| 466 37, | 466 37, |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 /* second non intra vlc table */ | 469 /* second non intra vlc table */ |
| 470 static const UINT16 table4_vlc[169][2] = { | 470 static const uint16_t table4_vlc[169][2] = { |
| 471 { 0x0, 3 },{ 0x3, 4 },{ 0xb, 5 },{ 0x14, 6 }, | 471 { 0x0, 3 },{ 0x3, 4 },{ 0xb, 5 },{ 0x14, 6 }, |
| 472 { 0x3f, 6 },{ 0x5d, 7 },{ 0xa2, 8 },{ 0xac, 9 }, | 472 { 0x3f, 6 },{ 0x5d, 7 },{ 0xa2, 8 },{ 0xac, 9 }, |
| 473 { 0x16e, 9 },{ 0x20a, 10 },{ 0x2e2, 10 },{ 0x432, 11 }, | 473 { 0x16e, 9 },{ 0x20a, 10 },{ 0x2e2, 10 },{ 0x432, 11 }, |
| 474 { 0x5c9, 11 },{ 0x827, 12 },{ 0xb54, 12 },{ 0x4e6, 13 }, | 474 { 0x5c9, 11 },{ 0x827, 12 },{ 0xb54, 12 },{ 0x4e6, 13 }, |
| 475 { 0x105f, 13 },{ 0x172a, 13 },{ 0x20b2, 14 },{ 0x2d4e, 14 }, | 475 { 0x105f, 13 },{ 0x172a, 13 },{ 0x20b2, 14 },{ 0x2d4e, 14 }, |
| 511 { 0x9dc, 14 },{ 0x20bb, 14 },{ 0x48c, 13 },{ 0x1723, 13 }, | 511 { 0x9dc, 14 },{ 0x20bb, 14 },{ 0x48c, 13 },{ 0x1723, 13 }, |
| 512 { 0x2e44, 14 },{ 0x16a5, 13 },{ 0x518, 11 },{ 0x39fe, 14 }, | 512 { 0x2e44, 14 },{ 0x16a5, 13 },{ 0x518, 11 },{ 0x39fe, 14 }, |
| 513 { 0x169, 9 }, | 513 { 0x169, 9 }, |
| 514 }; | 514 }; |
| 515 | 515 |
| 516 static const INT8 table4_level[168] = { | 516 static const int8_t table4_level[168] = { |
| 517 1, 2, 3, 4, 5, 6, 7, 8, | 517 1, 2, 3, 4, 5, 6, 7, 8, |
| 518 9, 10, 11, 12, 13, 14, 15, 16, | 518 9, 10, 11, 12, 13, 14, 15, 16, |
| 519 17, 18, 19, 20, 21, 22, 23, 1, | 519 17, 18, 19, 20, 21, 22, 23, 1, |
| 520 2, 3, 4, 5, 6, 7, 8, 9, | 520 2, 3, 4, 5, 6, 7, 8, 9, |
| 521 10, 11, 1, 2, 3, 4, 5, 6, | 521 10, 11, 1, 2, 3, 4, 5, 6, |
| 535 1, 2, 1, 1, 1, 1, 1, 1, | 535 1, 2, 1, 1, 1, 1, 1, 1, |
| 536 1, 1, 1, 1, 1, 1, 1, 1, | 536 1, 1, 1, 1, 1, 1, 1, 1, |
| 537 1, 1, 1, 1, 1, 1, 1, 1, | 537 1, 1, 1, 1, 1, 1, 1, 1, |
| 538 }; | 538 }; |
| 539 | 539 |
| 540 static const INT8 table4_run[168] = { | 540 static const int8_t table4_run[168] = { |
| 541 0, 0, 0, 0, 0, 0, 0, 0, | 541 0, 0, 0, 0, 0, 0, 0, 0, |
| 542 0, 0, 0, 0, 0, 0, 0, 0, | 542 0, 0, 0, 0, 0, 0, 0, 0, |
| 543 0, 0, 0, 0, 0, 0, 0, 1, | 543 0, 0, 0, 0, 0, 0, 0, 1, |
| 544 1, 1, 1, 1, 1, 1, 1, 1, | 544 1, 1, 1, 1, 1, 1, 1, 1, |
| 545 1, 1, 2, 2, 2, 2, 2, 2, | 545 1, 1, 2, 2, 2, 2, 2, 2, |
| 559 14, 14, 15, 16, 17, 18, 19, 20, | 559 14, 14, 15, 16, 17, 18, 19, 20, |
| 560 21, 22, 23, 24, 25, 26, 27, 28, | 560 21, 22, 23, 24, 25, 26, 27, 28, |
| 561 29, 30, 31, 32, 33, 34, 35, 36, | 561 29, 30, 31, 32, 33, 34, 35, 36, |
| 562 }; | 562 }; |
| 563 | 563 |
| 564 extern const UINT16 inter_vlc[103][2]; | 564 extern const uint16_t inter_vlc[103][2]; |
| 565 extern const INT8 inter_level[102]; | 565 extern const int8_t inter_level[102]; |
| 566 extern const INT8 inter_run[102]; | 566 extern const int8_t inter_run[102]; |
| 567 | 567 |
| 568 extern const UINT16 intra_vlc[103][2]; | 568 extern const uint16_t intra_vlc[103][2]; |
| 569 extern const INT8 intra_level[102]; | 569 extern const int8_t intra_level[102]; |
| 570 extern const INT8 intra_run[102]; | 570 extern const int8_t intra_run[102]; |
| 571 | 571 |
| 572 extern const UINT8 DCtab_lum[13][2]; | 572 extern const uint8_t DCtab_lum[13][2]; |
| 573 extern const UINT8 DCtab_chrom[13][2]; | 573 extern const uint8_t DCtab_chrom[13][2]; |
| 574 | 574 |
| 575 extern const UINT8 cbpy_tab[16][2]; | 575 extern const uint8_t cbpy_tab[16][2]; |
| 576 extern const UINT8 mvtab[33][2]; | 576 extern const uint8_t mvtab[33][2]; |
| 577 | 577 |
| 578 extern const UINT8 intra_MCBPC_code[8]; | 578 extern const uint8_t intra_MCBPC_code[8]; |
| 579 extern const UINT8 intra_MCBPC_bits[8]; | 579 extern const uint8_t intra_MCBPC_bits[8]; |
| 580 | 580 |
| 581 extern const UINT8 inter_MCBPC_code[25]; | 581 extern const uint8_t inter_MCBPC_code[25]; |
| 582 extern const UINT8 inter_MCBPC_bits[25]; | 582 extern const uint8_t inter_MCBPC_bits[25]; |
| 583 | 583 |
| 584 #define NB_RL_TABLES 6 | 584 #define NB_RL_TABLES 6 |
| 585 | 585 |
| 586 static RLTable rl_table[NB_RL_TABLES] = { | 586 static RLTable rl_table[NB_RL_TABLES] = { |
| 587 /* intra luminance tables */ | 587 /* intra luminance tables */ |
| 630 }, | 630 }, |
| 631 }; | 631 }; |
| 632 | 632 |
| 633 /* motion vector table 0 */ | 633 /* motion vector table 0 */ |
| 634 | 634 |
| 635 static const UINT16 table0_mv_code[1100] = { | 635 static const uint16_t table0_mv_code[1100] = { |
| 636 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001, | 636 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001, |
| 637 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f, | 637 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f, |
| 638 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b, | 638 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b, |
| 639 0x004d, 0x0003, 0x0022, 0x0023, 0x0025, 0x0027, 0x0042, 0x0048, | 639 0x004d, 0x0003, 0x0022, 0x0023, 0x0025, 0x0027, 0x0042, 0x0048, |
| 640 0x0049, 0x0050, 0x005c, 0x0091, 0x009f, 0x000e, 0x0043, 0x004c, | 640 0x0049, 0x0050, 0x005c, 0x0091, 0x009f, 0x000e, 0x0043, 0x004c, |
| 771 0x5efd, 0x5efe, 0x5eff, 0x5f00, 0x5f01, 0x5f02, 0x5f03, 0x5f04, | 771 0x5efd, 0x5efe, 0x5eff, 0x5f00, 0x5f01, 0x5f02, 0x5f03, 0x5f04, |
| 772 0x5f05, 0x5f06, 0x5f07, 0x5f08, 0x5f09, 0x5f0a, 0x5f0b, 0x5f0c, | 772 0x5f05, 0x5f06, 0x5f07, 0x5f08, 0x5f09, 0x5f0a, 0x5f0b, 0x5f0c, |
| 773 0x5f0d, 0x5f0e, 0x5f0f, 0x0000, | 773 0x5f0d, 0x5f0e, 0x5f0f, 0x0000, |
| 774 }; | 774 }; |
| 775 | 775 |
| 776 static const UINT8 table0_mv_bits[1100] = { | 776 static const uint8_t table0_mv_bits[1100] = { |
| 777 1, 4, 4, 4, 5, 5, 5, 6, | 777 1, 4, 4, 4, 5, 5, 5, 6, |
| 778 6, 6, 7, 7, 7, 8, 8, 8, | 778 6, 6, 7, 7, 7, 8, 8, 8, |
| 779 8, 8, 8, 8, 8, 8, 8, 8, | 779 8, 8, 8, 8, 8, 8, 8, 8, |
| 780 8, 9, 9, 9, 9, 9, 9, 9, | 780 8, 9, 9, 9, 9, 9, 9, 9, |
| 781 9, 9, 9, 9, 9, 10, 10, 10, | 781 9, 9, 9, 9, 9, 10, 10, 10, |
| 912 17, 17, 17, 17, 17, 17, 17, 17, | 912 17, 17, 17, 17, 17, 17, 17, 17, |
| 913 17, 17, 17, 17, 17, 17, 17, 17, | 913 17, 17, 17, 17, 17, 17, 17, 17, |
| 914 17, 17, 17, 8, | 914 17, 17, 17, 8, |
| 915 }; | 915 }; |
| 916 | 916 |
| 917 static const UINT8 table0_mvx[1099] = { | 917 static const uint8_t table0_mvx[1099] = { |
| 918 32, 32, 31, 32, 33, 31, 33, 31, | 918 32, 32, 31, 32, 33, 31, 33, 31, |
| 919 33, 32, 34, 32, 30, 32, 31, 34, | 919 33, 32, 34, 32, 30, 32, 31, 34, |
| 920 35, 32, 34, 33, 29, 33, 30, 30, | 920 35, 32, 34, 33, 29, 33, 30, 30, |
| 921 31, 31, 35, 29, 33, 35, 33, 34, | 921 31, 31, 35, 29, 33, 35, 33, 34, |
| 922 31, 29, 30, 34, 30, 36, 28, 32, | 922 31, 29, 30, 34, 30, 36, 28, 32, |
| 1053 39, 35, 59, 59, 18, 59, 39, 30, | 1053 39, 35, 59, 59, 18, 59, 39, 30, |
| 1054 18, 40, 60, 60, 61, 30, 18, 61, | 1054 18, 40, 60, 60, 61, 30, 18, 61, |
| 1055 61, 19, 19, | 1055 61, 19, 19, |
| 1056 }; | 1056 }; |
| 1057 | 1057 |
| 1058 static const UINT8 table0_mvy[1099] = { | 1058 static const uint8_t table0_mvy[1099] = { |
| 1059 32, 31, 32, 33, 32, 31, 31, 33, | 1059 32, 31, 32, 33, 32, 31, 31, 33, |
| 1060 33, 34, 32, 30, 32, 35, 34, 31, | 1060 33, 34, 32, 30, 32, 35, 34, 31, |
| 1061 32, 29, 33, 30, 32, 34, 33, 31, | 1061 32, 29, 33, 30, 32, 34, 33, 31, |
| 1062 30, 35, 31, 31, 29, 33, 35, 30, | 1062 30, 35, 31, 31, 29, 33, 35, 30, |
| 1063 29, 33, 34, 34, 30, 32, 32, 36, | 1063 29, 33, 34, 34, 30, 32, 32, 36, |
| 1195 40, 23, 34, 37, 5, 13, 42, 18, | 1195 40, 23, 34, 37, 5, 13, 42, 18, |
| 1196 25, 27, 28, | 1196 25, 27, 28, |
| 1197 }; | 1197 }; |
| 1198 | 1198 |
| 1199 /* motion vector table 1 */ | 1199 /* motion vector table 1 */ |
| 1200 static const UINT16 table1_mv_code[1100] = { | 1200 static const uint16_t table1_mv_code[1100] = { |
| 1201 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c, | 1201 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c, |
| 1202 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041, | 1202 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041, |
| 1203 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069, | 1203 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069, |
| 1204 0x006b, 0x00a6, 0x00c1, 0x00cb, 0x00cc, 0x00ce, 0x00da, 0x00e8, | 1204 0x006b, 0x00a6, 0x00c1, 0x00cb, 0x00cc, 0x00ce, 0x00da, 0x00e8, |
| 1205 0x00ee, 0x0087, 0x0090, 0x009e, 0x009f, 0x00ba, 0x00ca, 0x00d8, | 1205 0x00ee, 0x0087, 0x0090, 0x009e, 0x009f, 0x00ba, 0x00ca, 0x00d8, |
| 1336 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, | 1336 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, |
| 1337 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, | 1337 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, |
| 1338 0x2473, 0x26a2, 0x26a3, 0x000b, | 1338 0x2473, 0x26a2, 0x26a3, 0x000b, |
| 1339 }; | 1339 }; |
| 1340 | 1340 |
| 1341 static const UINT8 table1_mv_bits[1100] = { | 1341 static const uint8_t table1_mv_bits[1100] = { |
| 1342 2, 4, 4, 4, 5, 5, 5, 5, | 1342 2, 4, 4, 4, 5, 5, 5, 5, |
| 1343 6, 6, 7, 7, 7, 7, 7, 8, | 1343 6, 6, 7, 7, 7, 7, 7, 8, |
| 1344 8, 8, 8, 8, 8, 8, 8, 8, | 1344 8, 8, 8, 8, 8, 8, 8, 8, |
| 1345 8, 8, 8, 8, 8, 8, 8, 8, | 1345 8, 8, 8, 8, 8, 8, 8, 8, |
| 1346 8, 9, 9, 9, 9, 9, 9, 9, | 1346 8, 9, 9, 9, 9, 9, 9, 9, |
| 1477 15, 15, 15, 15, 15, 15, 15, 15, | 1477 15, 15, 15, 15, 15, 15, 15, 15, |
| 1478 15, 15, 15, 15, 15, 15, 15, 15, | 1478 15, 15, 15, 15, 15, 15, 15, 15, |
| 1479 15, 15, 15, 4, | 1479 15, 15, 15, 4, |
| 1480 }; | 1480 }; |
| 1481 | 1481 |
| 1482 static const UINT8 table1_mvx[1099] = { | 1482 static const uint8_t table1_mvx[1099] = { |
| 1483 32, 31, 32, 31, 33, 32, 33, 33, | 1483 32, 31, 32, 31, 33, 32, 33, 33, |
| 1484 31, 34, 30, 32, 32, 34, 35, 32, | 1484 31, 34, 30, 32, 32, 34, 35, 32, |
| 1485 34, 33, 29, 30, 30, 32, 31, 31, | 1485 34, 33, 29, 30, 30, 32, 31, 31, |
| 1486 33, 35, 35, 33, 31, 29, 29, 33, | 1486 33, 35, 35, 33, 31, 29, 29, 33, |
| 1487 34, 30, 31, 28, 36, 30, 34, 32, | 1487 34, 30, 31, 28, 36, 30, 34, 32, |
| 1618 20, 46, 14, 47, 38, 38, 38, 9, | 1618 20, 46, 14, 47, 38, 38, 38, 9, |
| 1619 34, 39, 43, 17, 39, 59, 5, 27, | 1619 34, 39, 43, 17, 39, 59, 5, 27, |
| 1620 0, 12, 27, | 1620 0, 12, 27, |
| 1621 }; | 1621 }; |
| 1622 | 1622 |
| 1623 static const UINT8 table1_mvy[1099] = { | 1623 static const uint8_t table1_mvy[1099] = { |
| 1624 32, 32, 31, 31, 32, 33, 31, 33, | 1624 32, 32, 31, 31, 32, 33, 31, 33, |
| 1625 33, 32, 32, 30, 34, 31, 32, 29, | 1625 33, 32, 32, 30, 34, 31, 32, 29, |
| 1626 33, 30, 32, 33, 31, 35, 34, 30, | 1626 33, 30, 32, 33, 31, 35, 34, 30, |
| 1627 34, 31, 33, 29, 29, 31, 33, 35, | 1627 34, 31, 33, 29, 29, 31, 33, 35, |
| 1628 30, 30, 35, 32, 32, 34, 34, 28, | 1628 30, 30, 35, 32, 32, 34, 34, 28, |
| 1762 }; | 1762 }; |
| 1763 | 1763 |
| 1764 /* motion vector table */ | 1764 /* motion vector table */ |
| 1765 typedef struct MVTable { | 1765 typedef struct MVTable { |
| 1766 int n; | 1766 int n; |
| 1767 const UINT16 *table_mv_code; | 1767 const uint16_t *table_mv_code; |
| 1768 const UINT8 *table_mv_bits; | 1768 const uint8_t *table_mv_bits; |
| 1769 const UINT8 *table_mvx; | 1769 const uint8_t *table_mvx; |
| 1770 const UINT8 *table_mvy; | 1770 const uint8_t *table_mvy; |
| 1771 UINT16 *table_mv_index; /* encoding: convert mv to index in table_mv */ | 1771 uint16_t *table_mv_index; /* encoding: convert mv to index in table_mv */ |
| 1772 VLC vlc; /* decoding: vlc */ | 1772 VLC vlc; /* decoding: vlc */ |
| 1773 } MVTable; | 1773 } MVTable; |
| 1774 | 1774 |
| 1775 static MVTable mv_tables[2] = { | 1775 static MVTable mv_tables[2] = { |
| 1776 { | 1776 { |
| 1787 table1_mvx, | 1787 table1_mvx, |
| 1788 table1_mvy, | 1788 table1_mvy, |
| 1789 } | 1789 } |
| 1790 }; | 1790 }; |
| 1791 | 1791 |
| 1792 static const UINT8 v2_mb_type[8][2] = { | 1792 static const uint8_t v2_mb_type[8][2] = { |
| 1793 {1, 1}, {0 , 2}, {3 , 3}, {9 , 5}, | 1793 {1, 1}, {0 , 2}, {3 , 3}, {9 , 5}, |
| 1794 {5, 4}, {0x21, 7}, {0x20, 7}, {0x11, 6}, | 1794 {5, 4}, {0x21, 7}, {0x20, 7}, {0x11, 6}, |
| 1795 }; | 1795 }; |
| 1796 | 1796 |
| 1797 static const UINT8 v2_intra_cbpc[4][2] = { | 1797 static const uint8_t v2_intra_cbpc[4][2] = { |
| 1798 {1, 1}, {0, 3}, {1, 3}, {1, 2}, | 1798 {1, 1}, {0, 3}, {1, 3}, {1, 2}, |
| 1799 }; | 1799 }; |
| 1800 | 1800 |
| 1801 static UINT8 wmv1_y_dc_scale_table[32]={ | 1801 static uint8_t wmv1_y_dc_scale_table[32]={ |
| 1802 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 | 1802 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 |
| 1803 0, 8, 8, 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 | 1803 0, 8, 8, 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 |
| 1804 }; | 1804 }; |
| 1805 static UINT8 wmv1_c_dc_scale_table[32]={ | 1805 static uint8_t wmv1_c_dc_scale_table[32]={ |
| 1806 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 | 1806 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 |
| 1807 0, 8, 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,22 | 1807 0, 8, 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,22 |
| 1808 }; | 1808 }; |
| 1809 | 1809 |
| 1810 static UINT8 old_ff_y_dc_scale_table[32]={ | 1810 static uint8_t old_ff_y_dc_scale_table[32]={ |
| 1811 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1811 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
| 1812 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 | 1812 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 |
| 1813 }; | 1813 }; |
| 1814 static UINT8 old_ff_c_dc_scale_table[32]={ | 1814 static uint8_t old_ff_c_dc_scale_table[32]={ |
| 1815 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1815 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
| 1816 0, 8, 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,22 | 1816 0, 8, 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,22 |
| 1817 }; | 1817 }; |
| 1818 | 1818 |
| 1819 | 1819 |
| 1820 #define WMV1_SCANTABLE_COUNT 4 | 1820 #define WMV1_SCANTABLE_COUNT 4 |
| 1821 | 1821 |
| 1822 static const UINT8 wmv1_scantable00[64]= { | 1822 static const uint8_t wmv1_scantable00[64]= { |
| 1823 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, | 1823 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, |
| 1824 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, | 1824 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, |
| 1825 0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05, | 1825 0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05, |
| 1826 0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A, | 1826 0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A, |
| 1827 0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, | 1827 0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, |
| 1828 0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34, | 1828 0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34, |
| 1829 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35, | 1829 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35, |
| 1830 0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F, | 1830 0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F, |
| 1831 }; | 1831 }; |
| 1832 static const UINT8 wmv1_scantable01[64]= { | 1832 static const uint8_t wmv1_scantable01[64]= { |
| 1833 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, | 1833 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, |
| 1834 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, | 1834 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, |
| 1835 0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D, | 1835 0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D, |
| 1836 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A, | 1836 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A, |
| 1837 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D, | 1837 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D, |
| 1838 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25, | 1838 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25, |
| 1839 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35, | 1839 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35, |
| 1840 0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F, | 1840 0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F, |
| 1841 }; | 1841 }; |
| 1842 static const UINT8 wmv1_scantable02[64]= { | 1842 static const uint8_t wmv1_scantable02[64]= { |
| 1843 0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18, | 1843 0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18, |
| 1844 0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20, | 1844 0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20, |
| 1845 0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07, | 1845 0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07, |
| 1846 0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, | 1846 0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, |
| 1847 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D, | 1847 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D, |
| 1848 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E, | 1848 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E, |
| 1849 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35, | 1849 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35, |
| 1850 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, | 1850 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, |
| 1851 }; | 1851 }; |
| 1852 static const UINT8 wmv1_scantable03[64]= { | 1852 static const uint8_t wmv1_scantable03[64]= { |
| 1853 0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09, | 1853 0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09, |
| 1854 0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29, | 1854 0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29, |
| 1855 0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13, | 1855 0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13, |
| 1856 0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C, | 1856 0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C, |
| 1857 0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24, | 1857 0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24, |
| 1858 0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E, | 1858 0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E, |
| 1859 0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35, | 1859 0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35, |
| 1860 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, | 1860 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, |
| 1861 }; | 1861 }; |
| 1862 | 1862 |
| 1863 static const UINT8 *wmv1_scantable[WMV1_SCANTABLE_COUNT+1]={ | 1863 static const uint8_t *wmv1_scantable[WMV1_SCANTABLE_COUNT+1]={ |
| 1864 wmv1_scantable00, | 1864 wmv1_scantable00, |
| 1865 wmv1_scantable01, | 1865 wmv1_scantable01, |
| 1866 wmv1_scantable02, | 1866 wmv1_scantable02, |
| 1867 wmv1_scantable03, | 1867 wmv1_scantable03, |
| 1868 }; | 1868 }; |
| 1869 | 1869 |
| 1870 static UINT8 table_inter_intra[4][2]={ | 1870 static const uint8_t table_inter_intra[4][2]={ |
| 1871 {0,1},{2,2},{6,3},{7,3} | 1871 {0,1},{2,2},{6,3},{7,3} |
| 1872 }; | 1872 }; |
| 1873 | 1873 |
| 1874 #define WMV2_INTER_CBP_TABLE_COUNT 4 | |
| 1875 | |
| 1876 static const uint32_t table_mb_non_intra2[128][2] = { | |
| 1877 {0x0000A7, 14}, {0x01B2B8, 18}, {0x01B28E, 18}, {0x036575, 19}, | |
| 1878 {0x006CAC, 16}, {0x000A69, 18}, {0x002934, 20}, {0x00526B, 21}, | |
| 1879 {0x006CA1, 16}, {0x01B2B9, 18}, {0x0029AD, 20}, {0x029353, 24}, | |
| 1880 {0x006CA7, 16}, {0x006CAB, 16}, {0x01B2BB, 18}, {0x00029B, 16}, | |
| 1881 {0x00D944, 17}, {0x000A6A, 18}, {0x0149A8, 23}, {0x03651F, 19}, | |
| 1882 {0x006CAF, 16}, {0x000A4C, 18}, {0x03651E, 19}, {0x000A48, 18}, | |
| 1883 {0x00299C, 20}, {0x00299F, 20}, {0x029352, 24}, {0x0029AC, 20}, | |
| 1884 {0x000296, 16}, {0x00D946, 17}, {0x000A68, 18}, {0x000298, 16}, | |
| 1885 {0x000527, 17}, {0x00D94D, 17}, {0x0014D7, 19}, {0x036574, 19}, | |
| 1886 {0x000A5C, 18}, {0x01B299, 18}, {0x00299D, 20}, {0x00299E, 20}, | |
| 1887 {0x000525, 17}, {0x000A66, 18}, {0x00A4D5, 22}, {0x00149B, 19}, | |
| 1888 {0x000295, 16}, {0x006CAD, 16}, {0x000A49, 18}, {0x000521, 17}, | |
| 1889 {0x006CAA, 16}, {0x00D945, 17}, {0x01B298, 18}, {0x00052F, 17}, | |
| 1890 {0x003654, 15}, {0x006CA0, 16}, {0x000532, 17}, {0x000291, 16}, | |
| 1891 {0x003652, 15}, {0x000520, 17}, {0x000A5D, 18}, {0x000294, 16}, | |
| 1892 {0x00009B, 11}, {0x0006E2, 12}, {0x000028, 12}, {0x0001B0, 10}, | |
| 1893 {0x000001, 3}, {0x000010, 8}, {0x00002F, 6}, {0x00004C, 10}, | |
| 1894 {0x00000D, 4}, {0x000000, 10}, {0x000006, 9}, {0x000134, 12}, | |
| 1895 {0x00000C, 4}, {0x000007, 10}, {0x000007, 9}, {0x0006E1, 12}, | |
| 1896 {0x00000E, 5}, {0x0000DA, 9}, {0x000022, 9}, {0x000364, 11}, | |
| 1897 {0x00000F, 4}, {0x000006, 10}, {0x00000F, 9}, {0x000135, 12}, | |
| 1898 {0x000014, 5}, {0x0000DD, 9}, {0x000004, 9}, {0x000015, 11}, | |
| 1899 {0x00001A, 6}, {0x0001B3, 10}, {0x000005, 10}, {0x0006E3, 12}, | |
| 1900 {0x00000C, 5}, {0x0000B9, 8}, {0x000004, 8}, {0x0000DB, 9}, | |
| 1901 {0x00000E, 4}, {0x00000B, 10}, {0x000023, 9}, {0x0006CB, 12}, | |
| 1902 {0x000005, 6}, {0x0001B1, 10}, {0x000001, 10}, {0x0006E0, 12}, | |
| 1903 {0x000011, 5}, {0x0000DF, 9}, {0x00000E, 9}, {0x000373, 11}, | |
| 1904 {0x000003, 5}, {0x0000B8, 8}, {0x000006, 8}, {0x000175, 9}, | |
| 1905 {0x000015, 5}, {0x000174, 9}, {0x000027, 9}, {0x000372, 11}, | |
| 1906 {0x000010, 5}, {0x0000BB, 8}, {0x000005, 8}, {0x0000DE, 9}, | |
| 1907 {0x00000F, 5}, {0x000001, 9}, {0x000012, 8}, {0x000004, 10}, | |
| 1908 {0x000002, 3}, {0x000016, 5}, {0x000009, 4}, {0x000001, 5}, | |
| 1909 }; | |
| 1910 | |
| 1911 static const uint32_t table_mb_non_intra3[128][2] = { | |
| 1912 {0x0002A1, 10}, {0x005740, 15}, {0x01A0BF, 18}, {0x015D19, 17}, | |
| 1913 {0x001514, 13}, {0x00461E, 15}, {0x015176, 17}, {0x015177, 17}, | |
| 1914 {0x0011AD, 13}, {0x00682E, 16}, {0x0682F9, 20}, {0x03417D, 19}, | |
| 1915 {0x001A36, 14}, {0x002A2D, 14}, {0x00D05E, 17}, {0x006824, 16}, | |
| 1916 {0x001515, 13}, {0x00545C, 15}, {0x0230E9, 18}, {0x011AFA, 17}, | |
| 1917 {0x0015D7, 13}, {0x005747, 15}, {0x008D79, 16}, {0x006825, 16}, | |
| 1918 {0x002BA2, 14}, {0x00A8BA, 16}, {0x0235F6, 18}, {0x015D18, 17}, | |
| 1919 {0x0011AE, 13}, {0x00346F, 15}, {0x008C3B, 16}, {0x00346E, 15}, | |
| 1920 {0x000D1A, 13}, {0x00461F, 15}, {0x0682F8, 20}, {0x011875, 17}, | |
| 1921 {0x002BA1, 14}, {0x008D61, 16}, {0x0235F7, 18}, {0x0230E8, 18}, | |
| 1922 {0x001513, 13}, {0x008D7B, 16}, {0x011AF4, 17}, {0x011AF5, 17}, | |
| 1923 {0x001185, 13}, {0x0046BF, 15}, {0x008D60, 16}, {0x008D7C, 16}, | |
| 1924 {0x001512, 13}, {0x00461C, 15}, {0x00AE8D, 16}, {0x008D78, 16}, | |
| 1925 {0x000D0E, 13}, {0x003413, 15}, {0x0046B1, 15}, {0x003416, 15}, | |
| 1926 {0x000AEA, 12}, {0x002A2C, 14}, {0x005741, 15}, {0x002A2F, 14}, | |
| 1927 {0x000158, 9}, {0x0008D2, 12}, {0x00054C, 11}, {0x000686, 12}, | |
| 1928 {0x000000, 2}, {0x000069, 8}, {0x00006B, 8}, {0x00068C, 12}, | |
| 1929 {0x000007, 3}, {0x00015E, 9}, {0x0002A3, 10}, {0x000AE9, 12}, | |
| 1930 {0x000006, 3}, {0x000231, 10}, {0x0002B8, 10}, {0x001A08, 14}, | |
| 1931 {0x000010, 5}, {0x0001A9, 10}, {0x000342, 11}, {0x000A88, 12}, | |
| 1932 {0x000004, 4}, {0x0001A2, 10}, {0x0002A4, 10}, {0x001184, 13}, | |
| 1933 {0x000012, 5}, {0x000232, 10}, {0x0002B2, 10}, {0x000680, 12}, | |
| 1934 {0x00001B, 6}, {0x00046A, 11}, {0x00068E, 12}, {0x002359, 14}, | |
| 1935 {0x000016, 5}, {0x00015F, 9}, {0x0002A0, 10}, {0x00054D, 11}, | |
| 1936 {0x000005, 4}, {0x000233, 10}, {0x0002B9, 10}, {0x0015D6, 13}, | |
| 1937 {0x000022, 6}, {0x000468, 11}, {0x000683, 12}, {0x001A0A, 14}, | |
| 1938 {0x000013, 5}, {0x000236, 10}, {0x0002BB, 10}, {0x001186, 13}, | |
| 1939 {0x000017, 5}, {0x0001AB, 10}, {0x0002A7, 10}, {0x0008D3, 12}, | |
| 1940 {0x000014, 5}, {0x000237, 10}, {0x000460, 11}, {0x000D0F, 13}, | |
| 1941 {0x000019, 6}, {0x0001AA, 10}, {0x0002B3, 10}, {0x000681, 12}, | |
| 1942 {0x000018, 6}, {0x0001A8, 10}, {0x0002A5, 10}, {0x00068F, 12}, | |
| 1943 {0x000007, 4}, {0x000055, 7}, {0x000047, 7}, {0x0000AD, 8}, | |
| 1944 }; | |
| 1945 | |
| 1946 static const uint32_t table_mb_non_intra4[128][2] = { | |
| 1947 {0x0000D4, 8}, {0x0021C5, 14}, {0x00F18A, 16}, {0x00D5BC, 16}, | |
| 1948 {0x000879, 12}, {0x00354D, 14}, {0x010E3F, 17}, {0x010F54, 17}, | |
| 1949 {0x000866, 12}, {0x00356E, 14}, {0x010F55, 17}, {0x010E3E, 17}, | |
| 1950 {0x0010CE, 13}, {0x003C84, 14}, {0x00D5BD, 16}, {0x00F18B, 16}, | |
| 1951 {0x000868, 12}, {0x00438C, 15}, {0x0087AB, 16}, {0x00790B, 15}, | |
| 1952 {0x000F10, 12}, {0x00433D, 15}, {0x006AD3, 15}, {0x00790A, 15}, | |
| 1953 {0x001AA7, 13}, {0x0043D4, 15}, {0x00871E, 16}, {0x006ADF, 15}, | |
| 1954 {0x000D7C, 12}, {0x003C94, 14}, {0x00438D, 15}, {0x006AD2, 15}, | |
| 1955 {0x0006BC, 11}, {0x0021E9, 14}, {0x006ADA, 15}, {0x006A99, 15}, | |
| 1956 {0x0010F7, 13}, {0x004389, 15}, {0x006ADB, 15}, {0x0078C4, 15}, | |
| 1957 {0x000D56, 12}, {0x0035F7, 14}, {0x00438E, 15}, {0x006A98, 15}, | |
| 1958 {0x000D52, 12}, {0x003C95, 14}, {0x004388, 15}, {0x00433C, 15}, | |
| 1959 {0x000D54, 12}, {0x001E4B, 13}, {0x003C63, 14}, {0x003C83, 14}, | |
| 1960 {0x000861, 12}, {0x0021EB, 14}, {0x00356C, 14}, {0x0035F6, 14}, | |
| 1961 {0x000863, 12}, {0x00219F, 14}, {0x003568, 14}, {0x003C82, 14}, | |
| 1962 {0x0001AE, 9}, {0x0010C0, 13}, {0x000F11, 12}, {0x001AFA, 13}, | |
| 1963 {0x000000, 1}, {0x0000F0, 8}, {0x0001AD, 9}, {0x0010C1, 13}, | |
| 1964 {0x00000A, 4}, {0x0003C5, 10}, {0x000789, 11}, {0x001AB5, 13}, | |
| 1965 {0x000009, 4}, {0x000435, 11}, {0x000793, 11}, {0x001E40, 13}, | |
| 1966 {0x00001D, 5}, {0x0003CB, 10}, {0x000878, 12}, {0x001AAF, 13}, | |
| 1967 {0x00000B, 4}, {0x0003C7, 10}, {0x000791, 11}, {0x001AAB, 13}, | |
| 1968 {0x00001F, 5}, {0x000436, 11}, {0x0006BF, 11}, {0x000F19, 12}, | |
| 1969 {0x00003D, 6}, {0x000D51, 12}, {0x0010C4, 13}, {0x0021E8, 14}, | |
| 1970 {0x000036, 6}, {0x000437, 11}, {0x0006AF, 11}, {0x0010C5, 13}, | |
| 1971 {0x00000C, 4}, {0x000432, 11}, {0x000794, 11}, {0x001E30, 13}, | |
| 1972 {0x000042, 7}, {0x000870, 12}, {0x000F24, 12}, {0x001E43, 13}, | |
| 1973 {0x000020, 6}, {0x00043E, 11}, {0x000795, 11}, {0x001AAA, 13}, | |
| 1974 {0x000037, 6}, {0x0006AC, 11}, {0x0006AE, 11}, {0x0010F6, 13}, | |
| 1975 {0x000034, 6}, {0x00043A, 11}, {0x000D50, 12}, {0x001AAE, 13}, | |
| 1976 {0x000039, 6}, {0x00043F, 11}, {0x00078D, 11}, {0x0010D2, 13}, | |
| 1977 {0x000038, 6}, {0x00043B, 11}, {0x0006BD, 11}, {0x0010D3, 13}, | |
| 1978 {0x000011, 5}, {0x0001AC, 9}, {0x0000F3, 8}, {0x000439, 11}, | |
| 1979 }; | |
| 1980 | |
| 1981 static const uint32_t (*wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={ | |
| 1982 table_mb_non_intra2, | |
| 1983 table_mb_non_intra3, | |
| 1984 table_mb_non_intra4, | |
| 1985 table_mb_non_intra, | |
| 1986 }; | |
| 1987 | |
| 1988 static const uint8_t wmv2_scantableA[64]={ | |
| 1989 0x00, 0x01, 0x02, 0x08, 0x03, 0x09, 0x0A, 0x10, | |
| 1990 0x04, 0x0B, 0x11, 0x18, 0x12, 0x0C, 0x05, 0x13, | |
| 1991 0x19, 0x0D, 0x14, 0x1A, 0x1B, 0x06, 0x15, 0x1C, | |
| 1992 0x0E, 0x16, 0x1D, 0x07, 0x1E, 0x0F, 0x17, 0x1F, | |
| 1993 }; | |
| 1994 | |
| 1995 static const uint8_t wmv2_scantableB[64]={ | |
| 1996 0x00, 0x08, 0x01, 0x10, 0x09, 0x18, 0x11, 0x02, | |
| 1997 0x20, 0x0A, 0x19, 0x28, 0x12, 0x30, 0x21, 0x1A, | |
| 1998 0x38, 0x29, 0x22, 0x03, 0x31, 0x39, 0x0B, 0x2A, | |
| 1999 0x13, 0x32, 0x1B, 0x3A, 0x23, 0x2B, 0x33, 0x3B, | |
| 2000 }; |
