comparison x86/mathops.h @ 8627:d6bab465b82c libavcodec

moves mid_pred() into mathops.h (with arch specific code split by directory)
author aurel
date Sun, 18 Jan 2009 22:57:40 +0000
parents 7768bdfd4f7b
children 4cea2f47219a
comparison
equal deleted inserted replaced
8626:8d425ee85ddb 8627:d6bab465b82c
20 */ 20 */
21 21
22 #ifndef AVCODEC_X86_MATHOPS_H 22 #ifndef AVCODEC_X86_MATHOPS_H
23 #define AVCODEC_X86_MATHOPS_H 23 #define AVCODEC_X86_MATHOPS_H
24 24
25 #include "config.h"
26 #include "libavutil/common.h"
27
25 #define MULL(ra, rb, shift) \ 28 #define MULL(ra, rb, shift) \
26 ({ int rt, dummy; __asm__ (\ 29 ({ int rt, dummy; __asm__ (\
27 "imull %3 \n\t"\ 30 "imull %3 \n\t"\
28 "shrdl %4, %%edx, %%eax \n\t"\ 31 "shrdl %4, %%edx, %%eax \n\t"\
29 : "=a"(rt), "=d"(dummy)\ 32 : "=a"(rt), "=d"(dummy)\
38 #define MUL64(ra, rb) \ 41 #define MUL64(ra, rb) \
39 ({ int64_t rt;\ 42 ({ int64_t rt;\
40 __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\ 43 __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\
41 rt; }) 44 rt; })
42 45
46 #if HAVE_CMOV
47 /* median of 3 */
48 #define mid_pred mid_pred
49 static inline av_const int mid_pred(int a, int b, int c)
50 {
51 int i=b;
52 __asm__ volatile(
53 "cmp %2, %1 \n\t"
54 "cmovg %1, %0 \n\t"
55 "cmovg %2, %1 \n\t"
56 "cmp %3, %1 \n\t"
57 "cmovl %3, %1 \n\t"
58 "cmp %1, %0 \n\t"
59 "cmovg %1, %0 \n\t"
60 :"+&r"(i), "+&r"(a)
61 :"r"(b), "r"(c)
62 );
63 return i;
64 }
65 #endif
66
43 #endif /* AVCODEC_X86_MATHOPS_H */ 67 #endif /* AVCODEC_X86_MATHOPS_H */