Commit 977f089d authored by Wim Taymans's avatar Wim Taymans
Browse files

gst/adder/gstadder.c: Don't clip float values. Fixes #350900.

Original commit message from CVS:
* gst/adder/gstadder.c:
Don't clip float values. Fixes #350900.
parent 23001d32
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?
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment