Mercurial > libavcodec.hg
comparison libpostproc/postprocess.c @ 799:fbbe46490ce9 libavcodec
cleanly passing the cpuCaps
| author | michael |
|---|---|
| date | Wed, 30 Oct 2002 01:50:58 +0000 |
| parents | 50ae708fc721 |
| children | f3a1bc99d4a0 |
comparison
equal
deleted
inserted
replaced
| 798:50ae708fc721 | 799:fbbe46490ce9 |
|---|---|
| 75 //#undef HAVE_MMX | 75 //#undef HAVE_MMX |
| 76 //#undef ARCH_X86 | 76 //#undef ARCH_X86 |
| 77 //#define DEBUG_BRIGHTNESS | 77 //#define DEBUG_BRIGHTNESS |
| 78 #include "../libvo/fastmemcpy.h" | 78 #include "../libvo/fastmemcpy.h" |
| 79 #include "postprocess.h" | 79 #include "postprocess.h" |
| 80 #include "../cpudetect.h" | |
| 81 #include "../mangle.h" | 80 #include "../mangle.h" |
| 82 | 81 |
| 83 #define MIN(a,b) ((a) > (b) ? (b) : (a)) | 82 #define MIN(a,b) ((a) > (b) ? (b) : (a)) |
| 84 #define MAX(a,b) ((a) < (b) ? (b) : (a)) | 83 #define MAX(a,b) ((a) < (b) ? (b) : (a)) |
| 85 #define ABS(a) ((a) > 0 ? (a) : (-(a))) | 84 #define ABS(a) ((a) > 0 ? (a) : (-(a))) |
| 102 #endif | 101 #endif |
| 103 | 102 |
| 104 static int verbose= 0; | 103 static int verbose= 0; |
| 105 | 104 |
| 106 static const int deringThreshold= 20; | 105 static const int deringThreshold= 20; |
| 106 | |
| 107 static int cpuCaps=0; | |
| 107 | 108 |
| 108 struct PPFilter{ | 109 struct PPFilter{ |
| 109 char *shortName; | 110 char *shortName; |
| 110 char *longName; | 111 char *longName; |
| 111 int chromDefault; // is chrominance filtering on by default if this filter is manually activated | 112 int chromDefault; // is chrominance filtering on by default if this filter is manually activated |
| 187 { | 188 { |
| 188 if(w05 + w20 + b00 + b01 + b02 + b08 + b80 == 0) b00=0; | 189 if(w05 + w20 + b00 + b01 + b02 + b08 + b80 == 0) b00=0; |
| 189 } | 190 } |
| 190 #endif | 191 #endif |
| 191 | 192 |
| 192 static inline long long rdtsc() | |
| 193 { | |
| 194 long long l; | |
| 195 asm volatile( "rdtsc\n\t" | |
| 196 : "=A" (l) | |
| 197 ); | |
| 198 // printf("%d\n", int(l/1000)); | |
| 199 return l; | |
| 200 } | |
| 201 | 193 |
| 202 #ifdef ARCH_X86 | 194 #ifdef ARCH_X86 |
| 203 static inline void prefetchnta(void *p) | 195 static inline void prefetchnta(void *p) |
| 204 { | 196 { |
| 205 asm volatile( "prefetchnta (%0)\n\t" | 197 asm volatile( "prefetchnta (%0)\n\t" |
| 226 asm volatile( "prefetcht2 (%0)\n\t" | 218 asm volatile( "prefetcht2 (%0)\n\t" |
| 227 : : "r" (p) | 219 : : "r" (p) |
| 228 ); | 220 ); |
| 229 } | 221 } |
| 230 #endif | 222 #endif |
| 223 | |
| 224 int pp_init(int caps){ | |
| 225 cpuCaps= caps; | |
| 226 | |
| 227 return 0; | |
| 228 } | |
| 231 | 229 |
| 232 // The horizontal Functions exist only in C cuz the MMX code is faster with vertical filters and transposing | 230 // The horizontal Functions exist only in C cuz the MMX code is faster with vertical filters and transposing |
| 233 | 231 |
| 234 /** | 232 /** |
| 235 * Check if the given 8x8 Block is mostly "flat" | 233 * Check if the given 8x8 Block is mostly "flat" |
| 506 // difference wouldnt be messureable here but its much better because | 504 // difference wouldnt be messureable here but its much better because |
| 507 // someone might exchange the cpu whithout restarting mplayer ;) | 505 // someone might exchange the cpu whithout restarting mplayer ;) |
| 508 #ifdef RUNTIME_CPUDETECT | 506 #ifdef RUNTIME_CPUDETECT |
| 509 #ifdef ARCH_X86 | 507 #ifdef ARCH_X86 |
| 510 // ordered per speed fasterst first | 508 // ordered per speed fasterst first |
| 511 if(gCpuCaps.hasMMX2) | 509 if(cpuCaps & PP_CPU_CAPS_MMX2) |
| 512 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); | 510 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); |
| 513 else if(gCpuCaps.has3DNow) | 511 else if(cpuCaps & PP_CPU_CAPS_3DNOW) |
| 514 postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); | 512 postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); |
| 515 else if(gCpuCaps.hasMMX) | 513 else if(cpuCaps & PP_CPU_CAPS_MMX) |
| 516 postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); | 514 postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); |
| 517 else | 515 else |
| 518 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); | 516 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); |
| 519 #else | 517 #else |
| 520 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); | 518 postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); |
