diff options
author | Luis de Bethencourt <luis@debethencourt.com> | 2012-05-17 09:46:37 +0100 |
---|---|---|
committer | Luis de Bethencourt <luis@debethencourt.com> | 2012-05-17 10:54:31 +0100 |
commit | 9cb4f4e6225fe6610ed155da1a8735514a4e6c76 (patch) | |
tree | 4e93b6b4bac5bbdbe30eee9c7238d0c527981f24 /gst/gaudieffects | |
parent | 4990dc2d1fb9e57efb19d003136d0fbfb63f945d (diff) | |
download | gstreamer-plugins-bad-9cb4f4e6225fe6610ed155da1a8735514a4e6c76.tar.gz |
gaudieffects: use CLAMP in exclusion
No need to have a gate_int () function duplicating the already existing and
established CLAMP () function.
Diffstat (limited to 'gst/gaudieffects')
-rw-r--r-- | gst/gaudieffects/gstexclusion.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/gst/gaudieffects/gstexclusion.c b/gst/gaudieffects/gstexclusion.c index 1c37311c8..313076088 100644 --- a/gst/gaudieffects/gstexclusion.c +++ b/gst/gaudieffects/gstexclusion.c @@ -95,7 +95,6 @@ enum #define DEFAULT_FACTOR 175 -static gint gate_int (gint value, gint min, gint max); static void transform (guint32 * src, guint32 * dest, gint video_area, gint factor); @@ -277,25 +276,13 @@ gst_exclusion_plugin_init (GstPlugin * exclusion) } /*** 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 transform (guint32 * src, guint32 * dest, gint video_area, gint factor) { - guint32 in, red, green, blue; - gint x; + guint32 in; + gint x, red, green, blue; for (x = 0; x < video_area; x++) { in = *src++; @@ -313,9 +300,9 @@ transform (guint32 * src, guint32 * dest, gint video_area, gint factor) (((factor - blue) * (factor - blue) / factor) + ((blue * blue) / factor)); - 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; } |