[FFmpeg-cvslog] avcodec/vc1_mc: move median4() to mathops.h

zhaoxiu.zeng git at videolan.org
Mon Feb 16 11:54:59 CET 2015


ffmpeg | branch: master | zhaoxiu.zeng <zhaoxiu.zeng at gmail.com> | Sat Feb 14 23:14:47 2015 +0800| [0f834155690aecc7400b77a968fea32200bfd5f0] | committer: Michael Niedermayer

avcodec/vc1_mc: move median4() to mathops.h

Needed for architecture specific optimizations

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f834155690aecc7400b77a968fea32200bfd5f0
---

 libavcodec/mathops.h |   14 ++++++++++++++
 libavcodec/vc1_mc.c  |   11 -----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 87fca0c..87d110b 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)
 {
diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c
index 17800cb..64f8854 100644
--- a/libavcodec/vc1_mc.c
+++ b/libavcodec/vc1_mc.c
@@ -240,17 +240,6 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir)
     }
 }
 
-static inline 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;
-    }
-}
-
 /** Do motion compensation for 4-MV macroblock - luminance block
  */
 void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)



More information about the ffmpeg-cvslog mailing list