From 72e6dd5e0c5bb9fc0b2de176adb98dce43c273be Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 24 Apr 2007 03:38:19 +0000 Subject: Do the clamping a little better. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13254 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/video_out_rockbox.c | 35 +++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index b55ca8c079..b57f77bc0a 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c @@ -31,9 +31,6 @@ extern struct plugin_api* rb; #include "mpeg2.h" #include "video_out.h" -#define CSUB_X 2 -#define CSUB_Y 2 - static int image_width; static int image_height; static int image_chroma_x; @@ -119,11 +116,11 @@ static void yuv_bitmap_part(unsigned char * const src[3], g = y + guv; b = y + bu; - if ((unsigned)(r | g | b) > 63*256) + if ((unsigned)(r | g | b) > 64*256-1) { - r = clamp(r, 0, 63*256); - g = clamp(g, 0, 63*256); - b = clamp(b, 0, 63*256); + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); } *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); @@ -139,11 +136,11 @@ static void yuv_bitmap_part(unsigned char * const src[3], g = y + guv; b = y + bu; - if ((unsigned)(r | g | b) > 63*256) + if ((unsigned)(r | g | b) > 64*256-1) { - r = clamp(r, 0, 63*256); - g = clamp(g, 0, 63*256); - b = clamp(b, 0, 63*256); + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); } *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); @@ -184,11 +181,11 @@ static void yuv_bitmap_part(unsigned char * const src[3], g = y + guv; b = y + bu; - if ((unsigned)(r | g | b) > 63*256) + if ((unsigned)(r | g | b) > 64*256-1) { - r = clamp(r, 0, 63*256); - g = clamp(g, 0, 63*256); - b = clamp(b, 0, 63*256); + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); } *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); @@ -204,11 +201,11 @@ static void yuv_bitmap_part(unsigned char * const src[3], g = y + guv; b = y + bu; - if ((unsigned)(r | g | b) > 63*256) + if ((unsigned)(r | g | b) > 64*256-1) { - r = clamp(r, 0, 63*256); - g = clamp(g, 0, 63*256); - b = clamp(b, 0, 63*256); + r = clamp(r, 0, 64*256-1); + g = clamp(g, 0, 64*256-1); + b = clamp(b, 0, 64*256-1); } *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); -- cgit v1.2.3