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

Needed for architecture specific optimizations

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
zhaoxiu.zeng 2015-02-14 23:14:47 +08:00 committed by Michael Niedermayer
parent 03adafb318
commit 0f83415569
2 changed files with 14 additions and 11 deletions

View File

@ -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)
{

View File

@ -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)