aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/conversion.h7
1 files changed, 7 insertions, 0 deletions
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
/**