comparison vp8data.h @ 12253:112b3a0db187 libavcodec

Decode DCT tokens by branching to a different code path for each branch on the huffman tree, instead of traversing the tree in a while loop. Based on the similar optimization in libvpx's detokenize.c 10% faster at normal bitrates, and 30% faster for high-bitrate intra-only
author conrad
date Fri, 23 Jul 2010 21:46:17 +0000
parents cf675a4d5195
children 7db147ea02c4
comparison
equal deleted inserted replaced
12252:b8211cda076d 12253:112b3a0db187
327 static const uint8_t vp8_coeff_band[16] = 327 static const uint8_t vp8_coeff_band[16] =
328 { 328 {
329 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7 329 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7
330 }; 330 };
331 331
332 static const int8_t vp8_coeff_tree[NUM_DCT_TOKENS-1][2] =
333 {
334 { -DCT_EOB, 1 }, // '0'
335 { -DCT_0, 2 }, // '10'
336 { -DCT_1, 3 }, // '110'
337 { 4, 6 },
338 { -DCT_2, 5 }, // '11100'
339 { -DCT_3, -DCT_4 }, // '111010', '111011'
340 { 7, 8 },
341 { -DCT_CAT1, -DCT_CAT2 }, // '111100', '111101'
342 { 9, 10 },
343 { -DCT_CAT3, -DCT_CAT4 }, // '1111100', '1111101'
344 { -DCT_CAT5, -DCT_CAT6 }, // '1111110', '1111111'
345 };
346
347 static const uint8_t vp8_dct_cat1_prob[] = { 159, 0 }; 332 static const uint8_t vp8_dct_cat1_prob[] = { 159, 0 };
348 static const uint8_t vp8_dct_cat2_prob[] = { 165, 145, 0 }; 333 static const uint8_t vp8_dct_cat2_prob[] = { 165, 145, 0 };
349 static const uint8_t vp8_dct_cat3_prob[] = { 173, 148, 140, 0 }; 334 static const uint8_t vp8_dct_cat3_prob[] = { 173, 148, 140, 0 };
350 static const uint8_t vp8_dct_cat4_prob[] = { 176, 155, 140, 135, 0 }; 335 static const uint8_t vp8_dct_cat4_prob[] = { 176, 155, 140, 135, 0 };
351 static const uint8_t vp8_dct_cat5_prob[] = { 180, 157, 141, 134, 130, 0 }; 336 static const uint8_t vp8_dct_cat5_prob[] = { 180, 157, 141, 134, 130, 0 };
352 static const uint8_t vp8_dct_cat6_prob[] = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 }; 337 static const uint8_t vp8_dct_cat6_prob[] = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
353 338
354 static const uint8_t * const vp8_dct_cat_prob[6] = 339 // only used for cat3 and above; cat 1 and 2 are referenced directly
355 { 340 static const uint8_t * const vp8_dct_cat_prob[] =
356 vp8_dct_cat1_prob, 341 {
357 vp8_dct_cat2_prob,
358 vp8_dct_cat3_prob, 342 vp8_dct_cat3_prob,
359 vp8_dct_cat4_prob, 343 vp8_dct_cat4_prob,
360 vp8_dct_cat5_prob, 344 vp8_dct_cat5_prob,
361 vp8_dct_cat6_prob, 345 vp8_dct_cat6_prob,
362 }; 346 };