# HG changeset patch # User michael # Date 1116361822 0 # Node ID fae7fce1a202140c5a5672a9a6f148366b7d6b32 # Parent 4fe1c19fc7a379161432391d03e02edcbc6651b4 SATURATE_U8 -> clip_uint8 (10% faster loop filter) diff -r 4fe1c19fc7a3 -r fae7fce1a202 vp3.c --- a/vp3.c Tue May 17 19:02:43 2005 +0000 +++ b/vp3.c Tue May 17 20:30:22 2005 +0000 @@ -2245,8 +2245,6 @@ 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 @@ (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 @@ (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); } }