audiowsinc{band,limit}: Fix check for divison by zero

This commit is contained in:
Sebastian Dröge 2011-04-13 18:11:34 +02:00
parent de7a976531
commit 6f480ad0ed
2 changed files with 6 additions and 6 deletions

View file

@ -272,10 +272,10 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
w = 2 * G_PI * (self->lower_frequency / GST_AUDIO_FILTER (self)->format.rate);
kernel_lp = g_new (gdouble, len);
for (i = 0; i < len; ++i) {
if (i % 2 == 1 && i == (len - 1) / 2)
if (i == (len - 1) / 2.0)
kernel_lp[i] = w;
else
kernel_lp[i] = sin (w * (i - (len - 1) / 2)) / (i - (len - 1) / 2);
kernel_lp[i] = sin (w * (i - (len - 1) / 2.0)) / (i - (len - 1) / 2.0);
/* windowing */
switch (self->window) {
@ -309,10 +309,10 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
w = 2 * G_PI * (self->upper_frequency / GST_AUDIO_FILTER (self)->format.rate);
kernel_hp = g_new (gdouble, len);
for (i = 0; i < len; ++i) {
if (i % 2 == 1 && i == (len - 1) / 2)
if (i == (len - 1) / 2.0)
kernel_hp[i] = w;
else
kernel_hp[i] = sin (w * (i - (len - 1) / 2)) / (i - (len - 1) / 2);
kernel_hp[i] = sin (w * (i - (len - 1) / 2.0)) / (i - (len - 1) / 2.0);
/* Windowing */
switch (self->window) {

View file

@ -258,10 +258,10 @@ gst_audio_wsinclimit_build_kernel (GstAudioWSincLimit * self)
kernel = g_new (gdouble, len);
for (i = 0; i < len; ++i) {
if (i % 2 == 1 && i == (len - 1) / 2)
if (i == (len - 1) / 2.0)
kernel[i] = w;
else
kernel[i] = sin (w * (i - (len - 1) / 2)) / (i - (len - 1) / 2);
kernel[i] = sin (w * (i - (len - 1) / 2)) / (i - (len - 1) / 2.0);
/* windowing */
switch (self->window) {