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.
This commit is contained in:
Sebastian Dröge 2008-05-20 10:47:10 +00:00
parent 0de3094950
commit 3d3f7cd6da
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2008-05-20 Sebastian Dröge <slomo@circular-chaos.org>
* 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.
2008-05-20 Jan Schmidt <jan.schmidt@sun.com>
* gst/videomixer/videomixer.c:

View file

@ -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);