Mercurial > libavcodec.hg
comparison libpostproc/postprocess.c @ 171:fa9734559c98 libavcodec
runtime cpu detect optional (compiles faster)
| author | michael |
|---|---|
| date | Tue, 27 Nov 2001 01:12:30 +0000 |
| parents | 20bcd5b70886 |
| children | 02b2b7ffe324 |
comparison
equal
deleted
inserted
replaced
| 170:dfdac3e25dcd | 171:fa9734559c98 |
|---|---|
| 402 src+=stride; | 402 src+=stride; |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 //Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | 407 //Note: we have C, MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one |
| 408 //Plain C versions | 408 //Plain C versions |
| 409 #if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT) | |
| 410 #define COMPILE_C | |
| 411 #endif | |
| 412 | |
| 413 #ifdef CAN_COMPILE_X86_ASM | |
| 414 | |
| 415 #if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) | |
| 416 #define COMPILE_MMX | |
| 417 #endif | |
| 418 | |
| 419 #if defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT) | |
| 420 #define COMPILE_MMX2 | |
| 421 #endif | |
| 422 | |
| 423 #if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) | |
| 424 #define COMPILE_3DNOW | |
| 425 #endif | |
| 426 #endif //CAN_COMPILE_X86_ASM | |
| 427 | |
| 428 #undef HAVE_MMX | |
| 429 #undef HAVE_MMX2 | |
| 430 #undef HAVE_3DNOW | |
| 431 #undef ARCH_X86 | |
| 432 | |
| 433 #ifdef COMPILE_C | |
| 409 #undef HAVE_MMX | 434 #undef HAVE_MMX |
| 410 #undef HAVE_MMX2 | 435 #undef HAVE_MMX2 |
| 411 #undef HAVE_3DNOW | 436 #undef HAVE_3DNOW |
| 412 #undef ARCH_X86 | 437 #undef ARCH_X86 |
| 413 #define RENAME(a) a ## _C | 438 #define RENAME(a) a ## _C |
| 414 #include "postprocess_template.c" | 439 #include "postprocess_template.c" |
| 415 | 440 #endif |
| 416 #ifdef CAN_COMPILE_X86_ASM | |
| 417 | 441 |
| 418 //MMX versions | 442 //MMX versions |
| 443 #ifdef COMPILE_MMX | |
| 419 #undef RENAME | 444 #undef RENAME |
| 420 #define HAVE_MMX | 445 #define HAVE_MMX |
| 421 #undef HAVE_MMX2 | 446 #undef HAVE_MMX2 |
| 422 #undef HAVE_3DNOW | 447 #undef HAVE_3DNOW |
| 423 #define ARCH_X86 | 448 #define ARCH_X86 |
| 424 #define RENAME(a) a ## _MMX | 449 #define RENAME(a) a ## _MMX |
| 425 #include "postprocess_template.c" | 450 #include "postprocess_template.c" |
| 451 #endif | |
| 426 | 452 |
| 427 //MMX2 versions | 453 //MMX2 versions |
| 454 #ifdef COMPILE_MMX2 | |
| 428 #undef RENAME | 455 #undef RENAME |
| 429 #define HAVE_MMX | 456 #define HAVE_MMX |
| 430 #define HAVE_MMX2 | 457 #define HAVE_MMX2 |
| 431 #undef HAVE_3DNOW | 458 #undef HAVE_3DNOW |
| 432 #define ARCH_X86 | 459 #define ARCH_X86 |
| 433 #define RENAME(a) a ## _MMX2 | 460 #define RENAME(a) a ## _MMX2 |
| 434 #include "postprocess_template.c" | 461 #include "postprocess_template.c" |
| 462 #endif | |
| 435 | 463 |
| 436 //3DNOW versions | 464 //3DNOW versions |
| 465 #ifdef COMPILE_3DNOW | |
| 437 #undef RENAME | 466 #undef RENAME |
| 438 #define HAVE_MMX | 467 #define HAVE_MMX |
| 439 #undef HAVE_MMX2 | 468 #undef HAVE_MMX2 |
| 440 #define HAVE_3DNOW | 469 #define HAVE_3DNOW |
| 441 #define ARCH_X86 | 470 #define ARCH_X86 |
| 442 #define RENAME(a) a ## _3DNow | 471 #define RENAME(a) a ## _3DNow |
| 443 #include "postprocess_template.c" | 472 #include "postprocess_template.c" |
| 444 | 473 #endif |
| 445 #endif //CAN_COMPILE_X86_ASM | |
| 446 | 474 |
| 447 // minor note: the HAVE_xyz is messed up after that line so dont use it | 475 // minor note: the HAVE_xyz is messed up after that line so dont use it |
| 448 | 476 |
| 449 static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, | 477 static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 450 QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode) | 478 QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode) |
| 451 { | 479 { |
| 452 // useing ifs here as they are faster than function pointers allthough the | 480 // useing ifs here as they are faster than function pointers allthough the |
| 453 // difference wouldnt be messureable here but its much better because | 481 // difference wouldnt be messureable here but its much better because |
| 454 // someone might exchange the cpu whithout restarting mplayer ;) | 482 // someone might exchange the cpu whithout restarting mplayer ;) |
| 455 | 483 #ifdef RUNTIME_CPUDETECT |
| 456 #ifdef CAN_COMPILE_X86_ASM | 484 #ifdef CAN_COMPILE_X86_ASM |
| 457 // ordered per speed fasterst first | 485 // ordered per speed fasterst first |
| 458 if(gCpuCaps.hasMMX2) | 486 if(gCpuCaps.hasMMX2) |
| 459 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | 487 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); |
| 460 else if(gCpuCaps.has3DNow) | 488 else if(gCpuCaps.has3DNow) |
| 464 else | 492 else |
| 465 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | 493 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); |
| 466 #else | 494 #else |
| 467 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | 495 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); |
| 468 #endif | 496 #endif |
| 497 #else //RUNTIME_CPUDETECT | |
| 498 #ifdef HAVE_MMX2 | |
| 499 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | |
| 500 #elif defined (HAVE_3DNOW) | |
| 501 postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | |
| 502 #elif defined (HAVE_MMX) | |
| 503 postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | |
| 504 #else | |
| 505 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode); | |
| 506 #endif | |
| 507 #endif //!RUNTIME_CPUDETECT | |
| 469 } | 508 } |
| 470 | 509 |
| 471 #ifdef HAVE_ODIVX_POSTPROCESS | 510 #ifdef HAVE_ODIVX_POSTPROCESS |
| 472 #include "../opendivx/postprocess.h" | 511 #include "../opendivx/postprocess.h" |
| 473 int use_old_pp=0; | 512 int use_old_pp=0; |
