gst/adder/gstadder.c: Don't clip float values. Fixes #350900.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 11 Aug 2006 15:53:43 +0000 (15:53 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 11 Aug 2006 15:53:43 +0000 (15:53 +0000)
Original commit message from CVS:
* gst/adder/gstadder.c:
Don't clip float values. Fixes #350900.

ChangeLog
gst/adder/gstadder.c

index 5c20ec8..c7bd725 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-11  Wim Taymans  <wim@fluendo.com>
+
+       * gst/adder/gstadder.c:
+       Don't clip float values. Fixes #350900.
+
 2006-08-11  Andy Wingo  <wingo@pobox.com>
 
        * gst/tcp/gsttcp.c: Really fix the build?
index 9f93722..864c568 100644 (file)
@@ -132,6 +132,7 @@ gst_adder_get_type (void)
   return adder_type;
 }
 
+/* clipping versions */
 #define MAKE_FUNC(name,type,ttype,min,max)                      \
 static void name (type *out, type *in, gint bytes) {            \
   gint i;                                                       \
@@ -139,6 +140,14 @@ static void name (type *out, type *in, gint bytes) {            \
     out[i] = CLAMP ((ttype)out[i] + (ttype)in[i], min, max);    \
 }
 
+/* non-clipping versions (for float) */
+#define MAKE_FUNC_NC(name,type,ttype)                           \
+static void name (type *out, type *in, gint bytes) {            \
+  gint i;                                                       \
+  for (i = 0; i < bytes / sizeof (type); i++)                   \
+    out[i] = (ttype)out[i] + (ttype)in[i];                      \
+}
+
 /* *INDENT-OFF* */
 MAKE_FUNC (add_int32, gint32, gint64, MIN_INT_32, MAX_INT_32)
 MAKE_FUNC (add_int16, gint16, gint32, MIN_INT_16, MAX_INT_16)
@@ -146,8 +155,8 @@ MAKE_FUNC (add_int8, gint8, gint16, MIN_INT_8, MAX_INT_8)
 MAKE_FUNC (add_uint32, guint32, guint64, MIN_UINT_32, MAX_UINT_32)
 MAKE_FUNC (add_uint16, guint16, guint32, MIN_UINT_16, MAX_UINT_16)
 MAKE_FUNC (add_uint8, guint8, guint16, MIN_UINT_8, MAX_UINT_8)
-MAKE_FUNC (add_float64, gdouble, gdouble, -1.0, 1.0)
-MAKE_FUNC (add_float32, gfloat, gfloat, -1.0, 1.0)
+MAKE_FUNC_NC (add_float64, gdouble, gdouble)
+MAKE_FUNC_NC (add_float32, gfloat, gfloat)
 /* *INDENT-ON* */
 
 static gboolean