[banshee/stable-1.8] [Equalizer] Fix distortion by using floating math
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/stable-1.8] [Equalizer] Fix distortion by using floating math
- Date: Thu, 4 Nov 2010 23:11:14 +0000 (UTC)
commit e7b2003dbec6d5e644ec9c98d69839041d6fdb92
Author: Ghislain 'Aus' Lacroix <aus songbirdnest com>
Date: Thu Nov 4 18:07:14 2010 -0500
[Equalizer] Fix distortion by using floating math
This is a patch against gst-plugins-good, commit
9507cdc84c968dc142356157c861e8d216b85716
Thanks to Zhou Ting for suggesting we apply it.
Fixes bgo#609463
Signed-off-by: Gabriel Burt <gabriel burt gmail com>
gstreamer/equalizer/gstiirequalizer.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gstreamer/equalizer/gstiirequalizer.c b/gstreamer/equalizer/gstiirequalizer.c
index c0e956c..254bdd9 100644
--- a/gstreamer/equalizer/gstiirequalizer.c
+++ b/gstreamer/equalizer/gstiirequalizer.c
@@ -396,9 +396,9 @@ setup_filter (GstIirEqualizer * equ, GstIirEqualizerBand * band)
gain = arg_to_scale (band->gain);
- if (band->freq / GST_AUDIO_FILTER (equ)->format.rate > 0.5)
+ if (band->freq / GST_AUDIO_FILTER (equ)->format.rate >= 0.5)
omega = M_PI;
- else if (band->freq < 0.0)
+ else if (band->freq <= 0.0)
omega = 0.0;
else
omega = 2.0 * M_PI * (band->freq / GST_AUDIO_FILTER (equ)->format.rate);
@@ -553,9 +553,9 @@ one_step_ ## TYPE (GstIirEqualizerBand *filter, \
SecondOrderHistory ## TYPE *history, BIG_TYPE input) \
{ \
/* calculate output */ \
- BIG_TYPE output = floor (filter->a0 * input + \
+ BIG_TYPE output = (filter->a0 * input + \
filter->a1 * history->x1 + filter->a2 * history->x2 + \
- filter->b1 * history->y1 + filter->b2 * history->y2 + 0.5); \
+ filter->b1 * history->y1 + filter->b2 * history->y2); \
/* update history */ \
history->y2 = history->y1; \
history->y1 = output; \
@@ -587,7 +587,7 @@ guint size, guint channels) \
history++; \
} \
cur = CLAMP (cur, MIN_VAL, MAX_VAL); \
- *((TYPE *) data) = (TYPE) cur; \
+ *((TYPE *) data) = (TYPE) floor (cur); \
data += sizeof (TYPE); \
} \
} \
@@ -643,7 +643,7 @@ guint size, guint channels) \
} \
}
-CREATE_OPTIMIZED_FUNCTIONS_INT (gint16, gint32, -32768, 32767);
+CREATE_OPTIMIZED_FUNCTIONS_INT (gint16, gdouble, -32768.0, 32767.0);
CREATE_OPTIMIZED_FUNCTIONS (gfloat);
CREATE_OPTIMIZED_FUNCTIONS (gdouble);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]