From 10e0187df1aa78c7259e8758dcea39d3886c1321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 Oct 2010 15:21:09 +0200 Subject: [PATCH] chromahold: Make everything greyscale if the target color is grey --- gst/coloreffects/gstchromahold.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/coloreffects/gstchromahold.c b/gst/coloreffects/gstchromahold.c index 2c4b2ff0f5..d2770e855f 100644 --- a/gst/coloreffects/gstchromahold.c +++ b/gst/coloreffects/gstchromahold.c @@ -308,7 +308,7 @@ rgb_to_hue (gint r, gint g, gint b) C = M - m; if (C == 0) { - h = 0; + return G_MAXUINT; } else if (M == r) { h = ((g - b) / C) % 6; } else if (M == g) { @@ -370,7 +370,7 @@ gst_chroma_hold_process_xrgb (guint8 * dest, gint width, h2 = rgb_to_hue (r, g, b); diff = hue_dist (h1, h2); - if (diff > tolerance) { + if (h1 == G_MAXUINT || diff > tolerance) { grey = (13938 * r + 46869 * g + 4730 * b) >> 16; grey = CLAMP (grey, 0, 255); dest[p[1]] = grey;