summaryrefslogtreecommitdiff
path: root/libavcodec/mathops.h
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2009-01-18 22:57:40 +0000
committerAurelien Jacobs <aurel@gnuage.org>2009-01-18 22:57:40 +0000
commit199436b952c198e14d53a389438e232ef60f1982 (patch)
treea4f1f4426da39f1af73f474f8df7c430025a2044 /libavcodec/mathops.h
parent48a81c0ff591347e58b9402534c5cf596ddf0072 (diff)
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/mathops.h')
-rw-r--r--libavcodec/mathops.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 9ef62cfb31..33e8cd6aec 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -83,5 +83,35 @@ static av_always_inline int MULH(int a, int b){
# 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 */