diff 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 7a463923ecd1
children 04423b2f6e0b
line wrap: on
line diff
--- a/mathops.h	Sun Jan 18 20:43:11 2009 +0000
+++ b/mathops.h	Sun Jan 18 22:57:40 2009 +0000
@@ -83,5 +83,35 @@
 #   define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
 #endif
 
+/* median of 3 */
+#ifndef mid_pred
+#define mid_pred mid_pred
+static inline av_const int mid_pred(int a, int b, int c)
+{
+#if 0
+    int t= (a-b)&((a-b)>>31);
+    a-=t;
+    b+=t;
+    b-= (b-c)&((b-c)>>31);
+    b+= (a-b)&((a-b)>>31);
+
+    return b;
+#else
+    if(a>b){
+        if(c>b){
+            if(c>a) b=a;
+            else    b=c;
+        }
+    }else{
+        if(b>c){
+            if(c>a) b=c;
+            else    b=a;
+        }
+    }
+    return b;
+#endif
+}
+#endif
+
 #endif /* AVCODEC_MATHOPS_H */