From e044e0fab4a8a6936cc02af2fd28cf7a5e0f1c7f Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Thu, 17 May 2012 09:47:08 +0100 Subject: [PATCH] gaudieffects: use CLAMP in solarize No need to have a gate_int () function duplicating the already existing and established CLAMP () function. --- gst/gaudieffects/gstsolarize.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/gst/gaudieffects/gstsolarize.c b/gst/gaudieffects/gstsolarize.c index 5ee4c2a418..f938f2439b 100644 --- a/gst/gaudieffects/gstsolarize.c +++ b/gst/gaudieffects/gstsolarize.c @@ -97,7 +97,6 @@ enum #define DEFAULT_START 50 #define DEFAULT_END 185 -static gint gate_int (gint value, gint min, gint max); static void transform (guint32 * src, guint32 * dest, gint video_area, gint threshold, gint start, gint end); @@ -306,18 +305,6 @@ gst_solarize_plugin_init (GstPlugin * solarize) } /*** Now the image processing work.... ***/ -/* Keep the values inbounds. */ -static gint -gate_int (gint value, gint min, gint max) -{ - if (value < min) { - return min; - } else if (value > max) { - return max; - } else { - return value; - } -} /* Transform processes each frame. */ static void @@ -377,9 +364,9 @@ transform (guint32 * src, guint32 * dest, gint video_area, } } - color[0] = gate_int (color[0], 0, 255); - color[1] = gate_int (color[1], 0, 255); - color[2] = gate_int (color[2], 0, 255); + color[0] = CLAMP (color[0], 0, 255); + color[1] = CLAMP (color[1], 0, 255); + color[2] = CLAMP (color[2], 0, 255); *dest++ = (color[0] << 16) | (color[1] << 8) | color[2]; }