diff options
Diffstat (limited to 'gst/filter')
-rw-r--r-- | gst/filter/gstbpwsinc.c | 44 | ||||
-rw-r--r-- | gst/filter/gstfilter.c | 2 | ||||
-rw-r--r-- | gst/filter/gstiir.c | 14 | ||||
-rw-r--r-- | gst/filter/gstlpwsinc.c | 26 |
4 files changed, 43 insertions, 43 deletions
diff --git a/gst/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c index a848cc26..ba0f2d67 100644 --- a/gst/filter/gstbpwsinc.c +++ b/gst/filter/gstbpwsinc.c @@ -35,8 +35,8 @@ #endif #include <gst/gst.h> #include "gstfilter.h" -#include <math.h> /* M_PI */ -#include <string.h> /* memmove */ +#include <math.h> /* M_PI */ +#include <string.h> /* memmove */ /* elementfactory information */ static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS ("BPWSinc", @@ -80,10 +80,10 @@ struct _GstBPWSinc double frequency; double lower_frequency, upper_frequency; - int wing_size; /* length of a "wing" of the filter; - actual length is 2 * wing_size + 1 */ + int wing_size; /* length of a "wing" of the filter; + actual length is 2 * wing_size + 1 */ - gfloat *residue; /* buffer for left-over samples from previous buffer */ + gfloat *residue; /* buffer for left-over samples from previous buffer */ double *kernel; }; @@ -125,7 +125,7 @@ gst_bpwsinc_get_type (void) }; bpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBPWSinc", - &bpwsinc_info, 0); + &bpwsinc_info, 0); } return bpwsinc_type; } @@ -157,16 +157,16 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWER_FREQUENCY, g_param_spec_double ("lower-frequency", "Lower Frequency", - "Cut-off lower frequency (relative to sample rate)", - 0.0, 0.5, 0, G_PARAM_READWRITE)); + "Cut-off lower frequency (relative to sample rate)", + 0.0, 0.5, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPPER_FREQUENCY, g_param_spec_double ("upper-frequency", "Upper Frequency", - "Cut-off upper frequency (relative to sample rate)", - 0.0, 0.5, 0, G_PARAM_READWRITE)); + "Cut-off upper frequency (relative to sample rate)", + 0.0, 0.5, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH, g_param_spec_int ("length", "Length", - "N such that the filter length = 2N + 1", - 1, G_MAXINT, 1, G_PARAM_READWRITE)); + "N such that the filter length = 2N + 1", + 1, G_MAXINT, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_bpwsinc_set_property; gobject_class->get_property = gst_bpwsinc_get_property; @@ -213,17 +213,17 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) len = filter->wing_size; /* fill the lp kernel */ GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f", - len * 2 + 1, filter->lower_frequency); + len * 2 + 1, filter->lower_frequency); kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1)); for (i = 0; i <= len * 2; ++i) { if (i == len) - kernel_lp[i] = 2 * M_PI * filter->lower_frequency; + kernel_lp[i] = 2 * M_PI * filter->lower_frequency; else - kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len)) - / (i - len); + kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len)) + / (i - len); /* Blackman windowing */ kernel_lp[i] *= (0.42 - 0.5 * cos (M_PI * i / len) - + 0.08 * cos (2 * M_PI * i / len)); + + 0.08 * cos (2 * M_PI * i / len)); } /* normalize for unity gain at DC @@ -236,17 +236,17 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) /* fill the hp kernel */ GST_DEBUG ("bpwsinc: initializing HP kernel of length %d with cut-off %f", - len * 2 + 1, filter->upper_frequency); + len * 2 + 1, filter->upper_frequency); kernel_hp = (double *) g_malloc (sizeof (double) * (2 * len + 1)); for (i = 0; i <= len * 2; ++i) { if (i == len) - kernel_hp[i] = 2 * M_PI * filter->upper_frequency; + kernel_hp[i] = 2 * M_PI * filter->upper_frequency; else - kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len)) - / (i - len); + kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len)) + / (i - len); /* Blackman windowing */ kernel_hp[i] *= (0.42 - 0.5 * cos (M_PI * i / len) - + 0.08 * cos (2 * M_PI * i / len)); + + 0.08 * cos (2 * M_PI * i / len)); } /* normalize for unity gain at DC diff --git a/gst/filter/gstfilter.c b/gst/filter/gstfilter.c index f723ae63..0fbc9609 100644 --- a/gst/filter/gstfilter.c +++ b/gst/filter/gstfilter.c @@ -59,7 +59,7 @@ plugin_init (GstPlugin * plugin) while (_elements[i].name) { if (!gst_element_register (plugin, _elements[i].name, GST_RANK_NONE, - _elements[i].type ())) + _elements[i].type ())) return FALSE; i++; diff --git a/gst/filter/gstiir.c b/gst/filter/gstiir.c index 5e44f3d0..2f69ae6a 100644 --- a/gst/filter/gstiir.c +++ b/gst/filter/gstiir.c @@ -109,7 +109,7 @@ gst_iir_get_type (void) }; iir_type = g_type_register_static (GST_TYPE_ELEMENT, "GstIIR", - &iir_info, 0); + &iir_info, 0); } return iir_type; } @@ -141,16 +141,16 @@ gst_iir_class_init (GstIIRClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A, g_param_spec_double ("A", "A", "A filter coefficient", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE)); + -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_B, g_param_spec_double ("B", "B", "B filter coefficient", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE)); + -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAIN, g_param_spec_double ("gain", "Gain", "Filter gain", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE)); + -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STAGES, g_param_spec_int ("stages", "Stages", "Number of filter stages", - 1, G_MAXINT, 1, G_PARAM_READWRITE)); + 1, G_MAXINT, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_iir_set_property; gobject_class->get_property = gst_iir_get_property; @@ -173,7 +173,7 @@ gst_iir_init (GstIIR * filter) filter->A = 0.0; filter->B = 0.0; - filter->gain = 1.0; /* unity gain as default */ + filter->gain = 1.0; /* unity gain as default */ filter->stages = 1; filter->state = NULL; } @@ -192,7 +192,7 @@ gst_iir_sink_connect (GstPad * pad, const GstCaps * caps) /* FIXME: remember to free it */ filter->state = (IIR_state *) g_malloc (sizeof (IIR_state)); IIR_init (filter->state, filter->stages, - filter->gain, &(filter->A), &(filter->B)); + filter->gain, &(filter->A), &(filter->B)); } return set_retval; diff --git a/gst/filter/gstlpwsinc.c b/gst/filter/gstlpwsinc.c index 0ce33b32..285c2edb 100644 --- a/gst/filter/gstlpwsinc.c +++ b/gst/filter/gstlpwsinc.c @@ -35,8 +35,8 @@ #endif #include <gst/gst.h> #include "gstfilter.h" -#include <math.h> /* M_PI */ -#include <string.h> /* memmove */ +#include <math.h> /* M_PI */ +#include <string.h> /* memmove */ static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc", "Filter/Effect/Audio", @@ -77,10 +77,10 @@ struct _GstLPWSinc GstPad *sinkpad, *srcpad; double frequency; - int wing_size; /* length of a "wing" of the filter; - actual length is 2 * wing_size + 1 */ + int wing_size; /* length of a "wing" of the filter; + actual length is 2 * wing_size + 1 */ - gfloat *residue; /* buffer for left-over samples from previous buffer */ + gfloat *residue; /* buffer for left-over samples from previous buffer */ double *kernel; }; @@ -122,7 +122,7 @@ gst_lpwsinc_get_type (void) }; lpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLPWSinc", - &lpwsinc_info, 0); + &lpwsinc_info, 0); } return lpwsinc_type; } @@ -154,12 +154,12 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY, g_param_spec_double ("frequency", "Frequency", - "Cut-off Frequency relative to sample rate)", - 0.0, 0.5, 0, G_PARAM_READWRITE)); + "Cut-off Frequency relative to sample rate)", + 0.0, 0.5, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH, g_param_spec_int ("length", "Length", - "N such that the filter length = 2N + 1", - 1, G_MAXINT, 1, G_PARAM_READWRITE)); + "N such that the filter length = 2N + 1", + 1, G_MAXINT, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_lpwsinc_set_property; gobject_class->get_property = gst_lpwsinc_get_property; @@ -210,10 +210,10 @@ gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) for (i = 0; i <= len * 2; ++i) { if (i == len) - filter->kernel[i] = 2 * M_PI * filter->frequency; + filter->kernel[i] = 2 * M_PI * filter->frequency; else - filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len)) - / (i - len); + filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len)) + / (i - len); /* windowing */ filter->kernel[i] *= (0.54 - 0.46 * cos (M_PI * i / len)); } |