From b775c03c29f6b256e9e01c5481949bb11300ce3a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 30 Dec 2009 15:29:52 +0000 Subject: Use the special Cinepak YUV2RGB function in the Cinepak decoder. This makes the Riven videos match up with the backgrounds better. Thanks, Torbjorn\! svn-id: r46750 --- graphics/conversion.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'graphics/conversion.h') diff --git a/graphics/conversion.h b/graphics/conversion.h index 0c47574117..262dcd6f5a 100644 --- a/graphics/conversion.h +++ b/graphics/conversion.h @@ -45,6 +45,13 @@ inline static void RGB2YUV(byte r, byte g, byte b, byte &y, byte &u, byte &v) { v = CLIP( ((r * 512) >> 10) - ((g * 429) >> 10) - ((b * 83) >> 10) + 128, 0, 255); } +/** Converting a color from YUV to RGB colorspace, Cinepak style. */ +inline static void CPYUV2RGB(byte y, byte u, byte v, byte &r, byte &g, byte &b) { + r = CLIP(y + 2 * (v - 128), 0, 255); + g = CLIP(y - (u - 128) / 2 - (v - 128), 0, 255); + b = CLIP(y + 2 * (u - 128), 0, 255); +} + // TODO: generic YUV to RGB blit /** -- cgit v1.2.3