summaryrefslogtreecommitdiffstats
path: root/firmware/target
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-03-30 10:09:19 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-03-30 10:09:19 +0000
commit4c59c1a4416389e68620eb37d11c30959ac82940 (patch)
tree6feb79b2612f1875a7ba1b35519eb6b0c0a8e216 /firmware/target
parentf46857f0851a85246096a1e02c92e374b7516375 (diff)
downloadrockbox-4c59c1a4416389e68620eb37d11c30959ac82940.tar.gz
rockbox-4c59c1a4416389e68620eb37d11c30959ac82940.zip
Correct the YCbCr to RGB conversion
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12969 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
index b9c09e9f7f..2d2f32069a 100644
--- a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
@@ -296,13 +296,16 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
#define CSUB_X 2
#define CSUB_Y 2
-#define RYFAC (31*257)
-#define GYFAC (63*257)
-#define BYFAC (31*257)
-#define RVFAC 11170 /* 31 * 257 * 1.402 */
-#define GVFAC (-11563) /* 63 * 257 * -0.714136 */
-#define GUFAC (-5572) /* 63 * 257 * -0.344136 */
-#define BUFAC 14118 /* 31 * 257 * 1.772 */
+#define RFULL (31*257)
+#define GFULL (63*257)
+#define BFULL (31*257)
+#define RYFAC 9277 /* 31 * 257 * 1.0 * (255/219) */
+#define GYFAC 18853 /* 63 * 257 * 1.0 * (255/219) */
+#define BYFAC 9277 /* 31 * 257 * 1.0 * (255/219) */
+#define RVFAC 12716 /* 31 * 257 * 1.402 * (255/224) */
+#define GVFAC (-13163) /* 63 * 257 * -0.714136 * (255/224) */
+#define GUFAC (-6343) /* 63 * 257 * -0.344136 * (255/224) */
+#define BUFAC 16071 /* 31 * 257 * 1.772 * (255/224) */
#define ROUNDOFFS (127*257)
@@ -342,31 +345,31 @@ void lcd_yuv_blit(unsigned char * const src[3],
do
{
- y = *ysrc++;
+ y = *ysrc++ - 16;
red = RYFAC * y + rc;
green = GYFAC * y + gc;
blue = BYFAC * y + bc;
- if ((unsigned)red > (RYFAC*255+ROUNDOFFS))
+ if ((unsigned)red > (RFULL*255+ROUNDOFFS))
{
if (red < 0)
red = 0;
else
- red = (RYFAC*255+ROUNDOFFS);
+ red = (RFULL*255+ROUNDOFFS);
}
- if ((unsigned)green > (GYFAC*255+ROUNDOFFS))
+ if ((unsigned)green > (GFULL*255+ROUNDOFFS))
{
if (green < 0)
green = 0;
else
- green = (GYFAC*255+ROUNDOFFS);
+ green = (GFULL*255+ROUNDOFFS);
}
- if ((unsigned)blue > (BYFAC*255+ROUNDOFFS))
+ if ((unsigned)blue > (BFULL*255+ROUNDOFFS))
{
if (blue < 0)
blue = 0;
else
- blue = (BYFAC*255+ROUNDOFFS);
+ blue = (BFULL*255+ROUNDOFFS);
}
rbits = ((unsigned)red) >> 16 ;
gbits = ((unsigned)green) >> 16 ;