summaryrefslogtreecommitdiff
path: root/libavcodec/mathops.h
diff options
context:
space:
mode:
authorzhaoxiu.zeng <zhaoxiu.zeng@gmail.com>2015-02-14 23:14:47 +0800
committerMichael Niedermayer <michaelni@gmx.at>2015-02-16 11:41:00 +0100
commit0f834155690aecc7400b77a968fea32200bfd5f0 (patch)
treed0800349de773885f44694e88a79c04b5c885999 /libavcodec/mathops.h
parent03adafb318e4746030d84f8b85047ab4958cff0f (diff)
downloadffmpeg-0f834155690aecc7400b77a968fea32200bfd5f0.tar.gz
avcodec/vc1_mc: move median4() to mathops.h
Needed for architecture specific optimizations Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mathops.h')
-rw-r--r--libavcodec/mathops.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 87fca0cad1..87d110b457 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -121,6 +121,20 @@ static inline av_const int mid_pred(int a, int b, int c)
}
#endif
+#ifndef median4
+#define median4 median4
+static inline av_const int median4(int a, int b, int c, int d)
+{
+ if (a < b) {
+ if (c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2;
+ else return (FFMIN(b, c) + FFMAX(a, d)) / 2;
+ } else {
+ if (c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2;
+ else return (FFMIN(a, c) + FFMAX(b, d)) / 2;
+ }
+}
+#endif
+
#ifndef sign_extend
static inline av_const int sign_extend(int val, unsigned bits)
{