From cb3d1794f812fd16eff90e873118d72f056b7c96 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Thu, 17 May 2012 09:44:29 +0100 Subject: [PATCH] gaudieffects: use CLAMP in chromium No need to have a gate_int () function duplicating the already existing and established CLAMP () function. --- gst/gaudieffects/gstchromium.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/gst/gaudieffects/gstchromium.c b/gst/gaudieffects/gstchromium.c index 3beae6a..05e67d5 100644 --- a/gst/gaudieffects/gstchromium.c +++ b/gst/gaudieffects/gstchromium.c @@ -107,7 +107,6 @@ gint cosTableMask = 1023; gint cosTable[2 * 512]; -static gint gate_int (gint value, gint min, gint max); void setup_cos_table (void); static gint cos_from_table (int angle); static inline int abs_int (int val); @@ -327,19 +326,6 @@ abs_int (int val) } } -/* 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; - } -} - /* Cosine from Table. */ static gint cos_from_table (int angle) @@ -353,8 +339,8 @@ static void transform (guint32 * src, guint32 * dest, gint video_area, gint edge_a, gint edge_b) { - guint32 in, red, green, blue; - gint x; + guint32 in; + gint x, red, green, blue; for (x = 0; x < video_area; x++) { in = *src++; @@ -368,9 +354,10 @@ transform (guint32 * src, guint32 * dest, gint video_area, (green + edge_a) + ((green * edge_b) / 2))); blue = abs_int (cos_from_table ((blue + edge_a) + ((blue * edge_b) / 2))); - red = gate_int (red, 0, 255); - green = gate_int (green, 0, 255); - blue = gate_int (blue, 0, 255); + red = CLAMP (red, 0, 255); + green = CLAMP (green, 0, 255); + blue = CLAMP (blue, 0, 255); + *dest++ = (red << 16) | (green << 8) | blue; } -- 2.7.4