Mercurial > libavcodec.hg
comparison dsputil.c @ 34:2733a4c1c693 libavcodec
added block permutation functions
author | glantau |
---|---|
date | Tue, 07 Aug 2001 22:43:19 +0000 |
parents | 82d4c9be9873 |
children | 4ea4c10d03d8 |
comparison
equal
deleted
inserted
replaced
33:7cf705a32d1c | 34:2733a4c1c693 |
---|---|
32 op_pixels_abs_func pix_abs16x16_xy2; | 32 op_pixels_abs_func pix_abs16x16_xy2; |
33 | 33 |
34 static UINT8 cropTbl[256 + 2 * MAX_NEG_CROP]; | 34 static UINT8 cropTbl[256 + 2 * MAX_NEG_CROP]; |
35 UINT32 squareTbl[512]; | 35 UINT32 squareTbl[512]; |
36 | 36 |
37 extern UINT16 default_intra_matrix[64]; | |
38 extern UINT16 default_non_intra_matrix[64]; | |
39 | |
40 UINT8 zigzag_direct[64] = { | |
41 0, 1, 8, 16, 9, 2, 3, 10, | |
42 17, 24, 32, 25, 18, 11, 4, 5, | |
43 12, 19, 26, 33, 40, 48, 41, 34, | |
44 27, 20, 13, 6, 7, 14, 21, 28, | |
45 35, 42, 49, 56, 57, 50, 43, 36, | |
46 29, 22, 15, 23, 30, 37, 44, 51, | |
47 58, 59, 52, 45, 38, 31, 39, 46, | |
48 53, 60, 61, 54, 47, 55, 62, 63 | |
49 }; | |
50 | |
51 UINT8 ff_alternate_horizontal_scan[64] = { | |
52 0, 1, 2, 3, 8, 9, 16, 17, | |
53 10, 11, 4, 5, 6, 7, 15, 14, | |
54 13, 12, 19, 18, 24, 25, 32, 33, | |
55 26, 27, 20, 21, 22, 23, 28, 29, | |
56 30, 31, 34, 35, 40, 41, 48, 49, | |
57 42, 43, 36, 37, 38, 39, 44, 45, | |
58 46, 47, 50, 51, 56, 57, 58, 59, | |
59 52, 53, 54, 55, 60, 61, 62, 63, | |
60 }; | |
61 | |
62 UINT8 ff_alternate_vertical_scan[64] = { | |
63 0, 8, 16, 24, 1, 9, 2, 10, | |
64 17, 25, 32, 40, 48, 56, 57, 49, | |
65 41, 33, 26, 18, 3, 11, 4, 12, | |
66 19, 27, 34, 42, 50, 58, 35, 43, | |
67 51, 59, 20, 28, 5, 13, 6, 14, | |
68 21, 29, 36, 44, 52, 60, 37, 45, | |
69 53, 61, 22, 30, 7, 15, 23, 31, | |
70 38, 46, 54, 62, 39, 47, 55, 63, | |
71 }; | |
72 | |
37 void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size) | 73 void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size) |
38 { | 74 { |
39 DCTELEM *p; | 75 DCTELEM *p; |
40 const UINT8 *pix; | 76 const UINT8 *pix; |
41 int i; | 77 int i; |
348 pix3 += line_size; | 384 pix3 += line_size; |
349 } | 385 } |
350 return s; | 386 return s; |
351 } | 387 } |
352 | 388 |
389 /* permute block according so that it corresponds to the MMX idct | |
390 order */ | |
391 void block_permute(INT16 *block) | |
392 { | |
393 int tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; | |
394 int i; | |
395 | |
396 for(i=0;i<8;i++) { | |
397 tmp1 = block[1]; | |
398 tmp2 = block[2]; | |
399 tmp3 = block[3]; | |
400 tmp4 = block[4]; | |
401 tmp5 = block[5]; | |
402 tmp6 = block[6]; | |
403 block[1] = tmp2; | |
404 block[2] = tmp4; | |
405 block[3] = tmp6; | |
406 block[4] = tmp1; | |
407 block[5] = tmp3; | |
408 block[6] = tmp5; | |
409 block += 8; | |
410 } | |
411 } | |
412 | |
353 void dsputil_init(void) | 413 void dsputil_init(void) |
354 { | 414 { |
355 int i; | 415 int i, j; |
356 | 416 |
357 for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i; | 417 for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i; |
358 for(i=0;i<MAX_NEG_CROP;i++) { | 418 for(i=0;i<MAX_NEG_CROP;i++) { |
359 cropTbl[i] = 0; | 419 cropTbl[i] = 0; |
360 cropTbl[i + MAX_NEG_CROP + 256] = 255; | 420 cropTbl[i + MAX_NEG_CROP + 256] = 255; |
373 pix_abs16x16_x2 = pix_abs16x16_x2_c; | 433 pix_abs16x16_x2 = pix_abs16x16_x2_c; |
374 pix_abs16x16_y2 = pix_abs16x16_y2_c; | 434 pix_abs16x16_y2 = pix_abs16x16_y2_c; |
375 pix_abs16x16_xy2 = pix_abs16x16_xy2_c; | 435 pix_abs16x16_xy2 = pix_abs16x16_xy2_c; |
376 av_fdct = jpeg_fdct_ifast; | 436 av_fdct = jpeg_fdct_ifast; |
377 | 437 |
438 /* permute for IDCT */ | |
439 for(i=0;i<64;i++) { | |
440 j = zigzag_direct[i]; | |
441 zigzag_direct[i] = block_permute_op(j); | |
442 j = ff_alternate_horizontal_scan[i]; | |
443 ff_alternate_horizontal_scan[i] = block_permute_op(j); | |
444 j = ff_alternate_vertical_scan[i]; | |
445 ff_alternate_vertical_scan[i] = block_permute_op(j); | |
446 } | |
447 block_permute(default_intra_matrix); | |
448 block_permute(default_non_intra_matrix); | |
449 | |
378 #ifdef HAVE_MMX | 450 #ifdef HAVE_MMX |
379 dsputil_init_mmx(); | 451 dsputil_init_mmx(); |
380 #endif | 452 #endif |
381 } | 453 } |