aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/common.h
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-09-15 00:36:49 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-09-15 00:36:49 +0000
commit93a319f13ba94c783afe5eb832f4de8980e6baa5 (patch)
tree164a7dfa4152a341449a9b653aa40e03ee611449 /libavutil/common.h
parent2a2311bee3284941117ac610921817d541d0c42f (diff)
downloadffmpeg-93a319f13ba94c783afe5eb832f4de8980e6baa5.tar.gz
asm implementation of mid_pred.
20% faster huffyuv decoding, 4% faster ffv1. Originally committed as revision 6254 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/common.h')
-rw-r--r--libavutil/common.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/libavutil/common.h b/libavutil/common.h
index 9d2d000475..c9bdd56b21 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -235,7 +235,22 @@ static inline int av_log2_16bit(unsigned int v)
/* median of 3 */
static inline int mid_pred(int a, int b, int c)
{
-#if 0
+#if (defined(ARCH_X86) && __CPU__ >= 686 || defined(ARCH_X86_64)) && !defined(RUNTIME_CPUDETECT)
+ int i=a, j=a;
+ asm volatile(
+ "cmp %4, %2 \n\t"
+ "cmovg %4, %0 \n\t"
+ "cmovl %4, %1 \n\t"
+ "cmp %4, %3 \n\t"
+ "cmovg %3, %0 \n\t"
+ "cmovl %3, %1 \n\t"
+ "cmp %3, %2 \n\t"
+ "cmovl %1, %0 \n\t"
+ :"+&r"(i), "+&r"(j)
+ :"r"(a), "r"(b), "r"(c)
+ );
+ return i;
+#elif 0
int t= (a-b)&((a-b)>>31);
a-=t;
b+=t;