summaryrefslogtreecommitdiffstats
path: root/gst/equalizer
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-05-20 10:47:10 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-05-20 10:47:10 +0000
commit3d3f7cd6dafbf0b5a49f94627fa638e493e6ca8f (patch)
treeafe5b8d714078977f0b0b7c8d5f7f85611b721a4 /gst/equalizer
parent0de3094950661600a9984075709fcde19831fc7a (diff)
gst/equalizer/gstiirequalizer.c: Use a bigger type in integer mode for the intermediate results to prevent overflows....
Original commit message from CVS: * gst/equalizer/gstiirequalizer.c: Use a bigger type in integer mode for the intermediate results to prevent overflows. This fixes the crippled sound when using the equalizer in integer mode. Fixes bug #510865.
Diffstat (limited to 'gst/equalizer')
-rw-r--r--gst/equalizer/gstiirequalizer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gst/equalizer/gstiirequalizer.c b/gst/equalizer/gstiirequalizer.c
index 684e8843..1cde3247 100644
--- a/gst/equalizer/gstiirequalizer.c
+++ b/gst/equalizer/gstiirequalizer.c
@@ -515,16 +515,16 @@ gst_iir_equalizer_compute_frequencies (GstIirEqualizer * equ, guint new_count)
#define CREATE_OPTIMIZED_FUNCTIONS(TYPE,BIG_TYPE,MIN_VAL,MAX_VAL) \
typedef struct { \
- TYPE x1, x2; /* history of input values for a filter */ \
- TYPE y1, y2; /* history of output values for a filter */ \
+ BIG_TYPE x1, x2; /* history of input values for a filter */ \
+ BIG_TYPE y1, y2; /* history of output values for a filter */ \
} SecondOrderHistory ## TYPE; \
\
-static inline TYPE \
+static inline BIG_TYPE \
one_step_ ## TYPE (GstIirEqualizerBand *filter, \
- SecondOrderHistory ## TYPE *history, TYPE input) \
+ SecondOrderHistory ## TYPE *history, BIG_TYPE input) \
{ \
/* calculate output */ \
- TYPE output = filter->a0 * input + filter->a1 * history->x1 + \
+ BIG_TYPE output = filter->a0 * input + filter->a1 * history->x1 + \
filter->a2 * history->x2 + filter->b1 * history->y1 + \
filter->b2 * history->y2; \
/* update history */ \
@@ -564,7 +564,7 @@ guint size, guint channels) \
} \
}
-CREATE_OPTIMIZED_FUNCTIONS (gint16, gint, -32768, 32767);
+CREATE_OPTIMIZED_FUNCTIONS (gint16, gint32, -32768, 32767);
CREATE_OPTIMIZED_FUNCTIONS (gfloat, gfloat, -1.0, 1.0);
CREATE_OPTIMIZED_FUNCTIONS (gdouble, gdouble, -1.0, 1.0);