Mercurial > libavcodec.hg
comparison dsputil.c @ 174:ac5075a55488 libavcodec
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
author | arpi_esp |
---|---|
date | Sun, 09 Dec 2001 12:04:09 +0000 |
parents | 06f63b58d2a8 |
children | 9e0e56869d05 |
comparison
equal
deleted
inserted
replaced
173:37eaaa9596cc | 174:ac5075a55488 |
---|---|
18 */ | 18 */ |
19 #include <stdlib.h> | 19 #include <stdlib.h> |
20 #include <stdio.h> | 20 #include <stdio.h> |
21 #include "avcodec.h" | 21 #include "avcodec.h" |
22 #include "dsputil.h" | 22 #include "dsputil.h" |
23 #include "simple_idct.h" | |
23 | 24 |
24 void (*ff_idct)(DCTELEM *block); | 25 void (*ff_idct)(DCTELEM *block); |
25 void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size); | 26 void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size); |
26 void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size); | 27 void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size); |
27 void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size); | 28 void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size); |
386 return s; | 387 return s; |
387 } | 388 } |
388 | 389 |
389 /* permute block according so that it corresponds to the MMX idct | 390 /* permute block according so that it corresponds to the MMX idct |
390 order */ | 391 order */ |
392 #ifdef SIMPLE_IDCT | |
393 void block_permute(INT16 *block) | |
394 { | |
395 int i; | |
396 INT16 temp[64]; | |
397 | |
398 // for(i=0; i<64; i++) temp[i] = block[ block_permute_op(i) ]; | |
399 for(i=0; i<64; i++) temp[ block_permute_op(i) ] = block[i]; | |
400 | |
401 for(i=0; i<64; i++) block[i] = temp[i]; | |
402 /* | |
403 for(i=0; i<64; i++) | |
404 { | |
405 if((i&7)==0) printf("\n"); | |
406 printf("%2d ", block[i]); | |
407 } | |
408 */ | |
409 } | |
410 | |
411 #else | |
412 | |
391 void block_permute(INT16 *block) | 413 void block_permute(INT16 *block) |
392 { | 414 { |
393 int tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; | 415 int tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; |
394 int i; | 416 int i; |
395 | 417 |
407 block[5] = tmp3; | 429 block[5] = tmp3; |
408 block[6] = tmp5; | 430 block[6] = tmp5; |
409 block += 8; | 431 block += 8; |
410 } | 432 } |
411 } | 433 } |
434 #endif | |
412 | 435 |
413 void dsputil_init(void) | 436 void dsputil_init(void) |
414 { | 437 { |
415 int i, j; | 438 int i, j; |
416 int use_permuted_idct; | 439 int use_permuted_idct; |
423 | 446 |
424 for(i=0;i<512;i++) { | 447 for(i=0;i<512;i++) { |
425 squareTbl[i] = (i - 256) * (i - 256); | 448 squareTbl[i] = (i - 256) * (i - 256); |
426 } | 449 } |
427 | 450 |
451 #ifdef SIMPLE_IDCT | |
452 ff_idct = simple_idct; | |
453 #else | |
428 ff_idct = j_rev_dct; | 454 ff_idct = j_rev_dct; |
455 #endif | |
429 get_pixels = get_pixels_c; | 456 get_pixels = get_pixels_c; |
430 put_pixels_clamped = put_pixels_clamped_c; | 457 put_pixels_clamped = put_pixels_clamped_c; |
431 add_pixels_clamped = add_pixels_clamped_c; | 458 add_pixels_clamped = add_pixels_clamped_c; |
432 | 459 |
433 pix_abs16x16 = pix_abs16x16_c; | 460 pix_abs16x16 = pix_abs16x16_c; |
445 dsputil_init_armv4l(); | 472 dsputil_init_armv4l(); |
446 #endif | 473 #endif |
447 #ifdef HAVE_MLIB | 474 #ifdef HAVE_MLIB |
448 dsputil_init_mlib(); | 475 dsputil_init_mlib(); |
449 use_permuted_idct = 0; | 476 use_permuted_idct = 0; |
477 #endif | |
478 | |
479 #ifdef SIMPLE_IDCT | |
480 if(ff_idct == simple_idct) use_permuted_idct=0; | |
450 #endif | 481 #endif |
451 | 482 |
452 if (use_permuted_idct) { | 483 if (use_permuted_idct) { |
453 /* permute for IDCT */ | 484 /* permute for IDCT */ |
454 for(i=0;i<64;i++) { | 485 for(i=0;i<64;i++) { |