diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2009-01-18 22:57:40 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2009-01-18 22:57:40 +0000 |
commit | 199436b952c198e14d53a389438e232ef60f1982 (patch) | |
tree | a4f1f4426da39f1af73f474f8df7c430025a2044 /libavcodec/x86/mathops.h | |
parent | 48a81c0ff591347e58b9402534c5cf596ddf0072 (diff) | |
download | ffmpeg-199436b952c198e14d53a389438e232ef60f1982.tar.gz |
moves mid_pred() into mathops.h (with arch specific code split by directory)
Originally committed as revision 16681 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/x86/mathops.h')
-rw-r--r-- | libavcodec/x86/mathops.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 95377acab8..6bd4b17705 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -22,6 +22,9 @@ #ifndef AVCODEC_X86_MATHOPS_H #define AVCODEC_X86_MATHOPS_H +#include "config.h" +#include "libavutil/common.h" + #define MULL(ra, rb, shift) \ ({ int rt, dummy; __asm__ (\ "imull %3 \n\t"\ @@ -40,4 +43,25 @@ __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\ rt; }) +#if HAVE_CMOV +/* median of 3 */ +#define mid_pred mid_pred +static inline av_const int mid_pred(int a, int b, int c) +{ + int i=b; + __asm__ volatile( + "cmp %2, %1 \n\t" + "cmovg %1, %0 \n\t" + "cmovg %2, %1 \n\t" + "cmp %3, %1 \n\t" + "cmovl %3, %1 \n\t" + "cmp %1, %0 \n\t" + "cmovg %1, %0 \n\t" + :"+&r"(i), "+&r"(a) + :"r"(b), "r"(c) + ); + return i; +} +#endif + #endif /* AVCODEC_X86_MATHOPS_H */ |