From 0f834155690aecc7400b77a968fea32200bfd5f0 Mon Sep 17 00:00:00 2001 From: "zhaoxiu.zeng" Date: Sat, 14 Feb 2015 23:14:47 +0800 Subject: [PATCH] avcodec/vc1_mc: move median4() to mathops.h Needed for architecture specific optimizations Signed-off-by: Michael Niedermayer --- 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 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) { diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index 17800cb457..64f8854a9f 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)