aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/video/cinepak.cpp2
-rw-r--r--graphics/conversion.h7
2 files changed, 8 insertions, 1 deletions
diff --git a/engines/mohawk/video/cinepak.cpp b/engines/mohawk/video/cinepak.cpp
index 5bf5d342a4..dc287ff56c 100644
--- a/engines/mohawk/video/cinepak.cpp
+++ b/engines/mohawk/video/cinepak.cpp
@@ -33,7 +33,7 @@
namespace Mohawk {
#define PUT_PIXEL(offset, lum, u, v) \
- Graphics::YUV2RGB(lum, u, v, r, g, b); \
+ Graphics::CPYUV2RGB(lum, u, v, r, g, b); \
if (_pixelFormat.bytesPerPixel == 2) \
*((uint16 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \
else \
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<int>( ((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<int>(y + 2 * (v - 128), 0, 255);
+ g = CLIP<int>(y - (u - 128) / 2 - (v - 128), 0, 255);
+ b = CLIP<int>(y + 2 * (u - 128), 0, 255);
+}
+
// TODO: generic YUV to RGB blit
/**