summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-24 03:38:19 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-24 03:38:19 +0000
commit72e6dd5e0c5bb9fc0b2de176adb98dce43c273be (patch)
tree5ae6adc43b5ae717d02d6102e7b11c20015846bc /apps
parent0d032d1fa1a6b1aa45515bc96a66918f4a7b45f1 (diff)
downloadrockbox-72e6dd5e0c5bb9fc0b2de176adb98dce43c273be.tar.gz
rockbox-72e6dd5e0c5bb9fc0b2de176adb98dce43c273be.zip
Do the clamping a little better.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13254 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/mpegplayer/video_out_rockbox.c35
1 files changed, 16 insertions, 19 deletions
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;
31#include "mpeg2.h" 31#include "mpeg2.h"
32#include "video_out.h" 32#include "video_out.h"
33 33
34#define CSUB_X 2
35#define CSUB_Y 2
36
37static int image_width; 34static int image_width;
38static int image_height; 35static int image_height;
39static int image_chroma_x; 36static int image_chroma_x;
@@ -119,11 +116,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
119 g = y + guv; 116 g = y + guv;
120 b = y + bu; 117 b = y + bu;
121 118
122 if ((unsigned)(r | g | b) > 63*256) 119 if ((unsigned)(r | g | b) > 64*256-1)
123 { 120 {
124 r = clamp(r, 0, 63*256); 121 r = clamp(r, 0, 64*256-1);
125 g = clamp(g, 0, 63*256); 122 g = clamp(g, 0, 64*256-1);
126 b = clamp(b, 0, 63*256); 123 b = clamp(b, 0, 64*256-1);
127 } 124 }
128 125
129 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 126 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
@@ -139,11 +136,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
139 g = y + guv; 136 g = y + guv;
140 b = y + bu; 137 b = y + bu;
141 138
142 if ((unsigned)(r | g | b) > 63*256) 139 if ((unsigned)(r | g | b) > 64*256-1)
143 { 140 {
144 r = clamp(r, 0, 63*256); 141 r = clamp(r, 0, 64*256-1);
145 g = clamp(g, 0, 63*256); 142 g = clamp(g, 0, 64*256-1);
146 b = clamp(b, 0, 63*256); 143 b = clamp(b, 0, 64*256-1);
147 } 144 }
148 145
149 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 146 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
@@ -184,11 +181,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
184 g = y + guv; 181 g = y + guv;
185 b = y + bu; 182 b = y + bu;
186 183
187 if ((unsigned)(r | g | b) > 63*256) 184 if ((unsigned)(r | g | b) > 64*256-1)
188 { 185 {
189 r = clamp(r, 0, 63*256); 186 r = clamp(r, 0, 64*256-1);
190 g = clamp(g, 0, 63*256); 187 g = clamp(g, 0, 64*256-1);
191 b = clamp(b, 0, 63*256); 188 b = clamp(b, 0, 64*256-1);
192 } 189 }
193 190
194 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 191 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
@@ -204,11 +201,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
204 g = y + guv; 201 g = y + guv;
205 b = y + bu; 202 b = y + bu;
206 203
207 if ((unsigned)(r | g | b) > 63*256) 204 if ((unsigned)(r | g | b) > 64*256-1)
208 { 205 {
209 r = clamp(r, 0, 63*256); 206 r = clamp(r, 0, 64*256-1);
210 g = clamp(g, 0, 63*256); 207 g = clamp(g, 0, 64*256-1);
211 b = clamp(b, 0, 63*256); 208 b = clamp(b, 0, 64*256-1);
212 } 209 }
213 210
214 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 211 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);