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.
This commit is contained in:
Wim Taymans 2006-08-11 15:53:43 +00:00
parent 23001d327a
commit 977f089d84
2 changed files with 16 additions and 2 deletions

View file

@ -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?

View 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