aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-05-17 20:30:22 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-05-17 20:30:22 +0000
commitee408eadbadbc629c9ef06f62ddf63643defe541 (patch)
tree774a413494324670a455f509bf0a7c27ad7788c8
parent0bde73d907dbe684e01bafc979bf4a04ddeace1d (diff)
downloadffmpeg-ee408eadbadbc629c9ef06f62ddf63643defe541.tar.gz
SATURATE_U8 -> clip_uint8 (10% faster loop filter)
Originally committed as revision 4262 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/vp3.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 6bf200b9a1..7d4b9e8bec 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2245,8 +2245,6 @@ av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x,
emms_c();
}
-#define SATURATE_U8(x) ((x) < 0) ? 0 : ((x) > 255) ? 255 : x
-
static void horizontal_filter(unsigned char *first_pixel, int stride,
int *bounding_values)
{
@@ -2260,8 +2258,8 @@ static void horizontal_filter(unsigned char *first_pixel, int stride,
(first_pixel[ 0] * 3) -
(first_pixel[ 1] * 1);
filter_value = bounding_values[(filter_value + 4) >> 3];
- first_pixel[-1] = SATURATE_U8(first_pixel[-1] + filter_value);
- first_pixel[ 0] = SATURATE_U8(first_pixel[ 0] - filter_value);
+ first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value);
+ first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value);
}
}
@@ -2278,8 +2276,8 @@ static void vertical_filter(unsigned char *first_pixel, int stride,
(first_pixel[ (0 )] * 3) -
(first_pixel[ (1 * stride)] * 1);
filter_value = bounding_values[(filter_value + 4) >> 3];
- first_pixel[-(1 * stride)] = SATURATE_U8(first_pixel[-(1 * stride)] + filter_value);
- first_pixel[0] = SATURATE_U8(first_pixel[0] - filter_value);
+ first_pixel[-(1 * stride)] = clip_uint8(first_pixel[-(1 * stride)] + filter_value);
+ first_pixel[0] = clip_uint8(first_pixel[0] - filter_value);
}
}