summaryrefslogtreecommitdiffstats
path: root/gst/videomixer
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-05-28 13:56:15 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-05-28 13:58:48 +0200
commita5c30ae5028d054c5a3c4014d0eda1ea92d05b1f (patch)
tree9500e135868143a70b704b1ecf947350a2839efe /gst/videomixer
parent83fc39ccff50b2d6071650e4300f1239ef23f0c0 (diff)
videomixer: Fix background blitting when a color mode is selected with BGRA
Diffstat (limited to 'gst/videomixer')
-rw-r--r--gst/videomixer/blend_bgra.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gst/videomixer/blend_bgra.c b/gst/videomixer/blend_bgra.c
index 36ac2e96..485f0c76 100644
--- a/gst/videomixer/blend_bgra.c
+++ b/gst/videomixer/blend_bgra.c
@@ -111,17 +111,18 @@ gst_videomixer_fill_bgra_color (guint8 * dest, gint width, gint height,
gint red, green, blue;
gint i, j;
- red = 1.164 * (colY - 16) + 1.596 * (colV - 128);
- green = 1.164 * (colY - 16) - 0.813 * (colV - 128) - 0.391 * (colU - 128);
- blue = 1.164 * (colY - 16) + 2.018 * (colU - 128);
-
+ red = CLAMP (1.164 * (colY - 16) + 1.596 * (colV - 128), 0, 255);
+ green =
+ CLAMP (1.164 * (colY - 16) - 0.813 * (colV - 128) - 0.391 * (colU - 128),
+ 0, 255);
+ blue = CLAMP (1.164 * (colY - 16) + 2.018 * (colU - 128), 0, 255);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
+ *dest++ = blue;
+ *dest++ = green;
+ *dest++ = red;
*dest++ = 0xff;
- *dest++ = colY;
- *dest++ = colU;
- *dest++ = colV;
}
}
}