mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
Use generator macros for the process functions for the different sample types, add lower upper boundaries for the GOb...
Original commit message from CVS: * gst/filter/gstbpwsinc.c: (gst_bpwsinc_class_init), (bpwsinc_set_property), (bpwsinc_get_property): * gst/filter/gstbpwsinc.h: * gst/filter/gstlpwsinc.c: (gst_lpwsinc_class_init), (gst_lpwsinc_init), (lpwsinc_build_kernel), (lpwsinc_set_property), (lpwsinc_get_property): * gst/filter/gstlpwsinc.h: * tests/check/elements/lpwsinc.c: (GST_START_TEST): Use generator macros for the process functions for the different sample types, add lower upper boundaries for the GObject properties so automatically generated UIs can use sliders and change frequency properties to floats to save a bit of memory, even ints would in theory be enough. Also rename frequency to cutoff for consistency reasons. * docs/plugins/gst-plugins-bad-plugins.args: * docs/plugins/gst-plugins-bad-plugins.signals: * docs/plugins/inspect/plugin-gstrtpmanager.xml: Regenerated for the above changes.
This commit is contained in:
parent
f86bfaf5f9
commit
1301d15e4f
5 changed files with 116 additions and 184 deletions
|
@ -230,18 +230,18 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
|
||||||
gobject_class->get_property = bpwsinc_get_property;
|
gobject_class->get_property = bpwsinc_get_property;
|
||||||
gobject_class->dispose = gst_bpwsinc_dispose;
|
gobject_class->dispose = gst_bpwsinc_dispose;
|
||||||
|
|
||||||
|
/* FIXME: Don't use the complete possible range but restrict the upper boundary
|
||||||
|
* so automatically generated UIs can use a slider */
|
||||||
g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY,
|
g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY,
|
||||||
g_param_spec_double ("lower-frequency", "Lower Frequency",
|
g_param_spec_float ("lower-frequency", "Lower Frequency",
|
||||||
"Cut-off lower frequency (Hz)",
|
"Cut-off lower frequency (Hz)", 0.0, 100000.0, 0, G_PARAM_READWRITE));
|
||||||
0.0, G_MAXDOUBLE, 0, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY,
|
g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY,
|
||||||
g_param_spec_double ("upper-frequency", "Upper Frequency",
|
g_param_spec_float ("upper-frequency", "Upper Frequency",
|
||||||
"Cut-off upper frequency (Hz)",
|
"Cut-off upper frequency (Hz)", 0.0, 100000.0, 0, G_PARAM_READWRITE));
|
||||||
0.0, G_MAXDOUBLE, 0, G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (gobject_class, PROP_LENGTH,
|
g_object_class_install_property (gobject_class, PROP_LENGTH,
|
||||||
g_param_spec_int ("length", "Length",
|
g_param_spec_int ("length", "Length",
|
||||||
"Filter kernel length, will be rounded to the next odd number",
|
"Filter kernel length, will be rounded to the next odd number",
|
||||||
3, G_MAXINT, 101, G_PARAM_READWRITE));
|
3, 50000, 101, G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MODE,
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
||||||
g_param_spec_enum ("mode", "Mode",
|
g_param_spec_enum ("mode", "Mode",
|
||||||
|
@ -282,86 +282,51 @@ gst_bpwsinc_init (GstBPWSinc * self, GstBPWSincClass * g_class)
|
||||||
bpwsinc_query_type);
|
bpwsinc_query_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
#define DEFINE_PROCESS_FUNC(width,ctype) \
|
||||||
process_32 (GstBPWSinc * self, gfloat * src, gfloat * dst, guint input_samples)
|
static void \
|
||||||
{
|
process_##width (GstBPWSinc * self, g##ctype * src, g##ctype * dst, guint input_samples) \
|
||||||
gint kernel_length = self->kernel_length;
|
{ \
|
||||||
gint i, j, k, l;
|
gint kernel_length = self->kernel_length; \
|
||||||
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
gint i, j, k, l; \
|
||||||
gint res_start;
|
gint channels = GST_AUDIO_FILTER (self)->format.channels; \
|
||||||
|
gint res_start; \
|
||||||
/* convolution */
|
\
|
||||||
for (i = 0; i < input_samples; i++) {
|
/* convolution */ \
|
||||||
dst[i] = 0.0;
|
for (i = 0; i < input_samples; i++) { \
|
||||||
k = i % channels;
|
dst[i] = 0.0; \
|
||||||
l = i / channels;
|
k = i % channels; \
|
||||||
for (j = 0; j < kernel_length; j++)
|
l = i / channels; \
|
||||||
if (l < j)
|
for (j = 0; j < kernel_length; j++) \
|
||||||
dst[i] +=
|
if (l < j) \
|
||||||
self->residue[(kernel_length + l - j) * channels +
|
dst[i] += \
|
||||||
k] * self->kernel[j];
|
self->residue[(kernel_length + l - j) * channels + \
|
||||||
else
|
k] * self->kernel[j]; \
|
||||||
dst[i] += src[(l - j) * channels + k] * self->kernel[j];
|
else \
|
||||||
}
|
dst[i] += src[(l - j) * channels + k] * self->kernel[j]; \
|
||||||
|
} \
|
||||||
/* copy the tail of the current input buffer to the residue, while
|
\
|
||||||
* keeping parts of the residue if the input buffer is smaller than
|
/* copy the tail of the current input buffer to the residue, while \
|
||||||
* the kernel length */
|
* keeping parts of the residue if the input buffer is smaller than \
|
||||||
if (input_samples < kernel_length * channels)
|
* the kernel length */ \
|
||||||
res_start = kernel_length * channels - input_samples;
|
if (input_samples < kernel_length * channels) \
|
||||||
else
|
res_start = kernel_length * channels - input_samples; \
|
||||||
res_start = 0;
|
else \
|
||||||
|
res_start = 0; \
|
||||||
for (i = 0; i < res_start; i++)
|
\
|
||||||
self->residue[i] = self->residue[i + input_samples];
|
for (i = 0; i < res_start; i++) \
|
||||||
for (i = res_start; i < kernel_length * channels; i++)
|
self->residue[i] = self->residue[i + input_samples]; \
|
||||||
self->residue[i] = src[input_samples - kernel_length * channels + i];
|
for (i = res_start; i < kernel_length * channels; i++) \
|
||||||
|
self->residue[i] = src[input_samples - kernel_length * channels + i]; \
|
||||||
self->residue_length += kernel_length * channels - res_start;
|
\
|
||||||
if (self->residue_length > kernel_length * channels)
|
self->residue_length += kernel_length * channels - res_start; \
|
||||||
self->residue_length = kernel_length * channels;
|
if (self->residue_length > kernel_length * channels) \
|
||||||
|
self->residue_length = kernel_length * channels; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
DEFINE_PROCESS_FUNC (32, float);
|
||||||
process_64 (GstBPWSinc * self, gdouble * src, gdouble * dst,
|
DEFINE_PROCESS_FUNC (64, double);
|
||||||
guint input_samples)
|
|
||||||
{
|
|
||||||
gint kernel_length = self->kernel_length;
|
|
||||||
gint i, j, k, l;
|
|
||||||
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
|
||||||
gint res_start;
|
|
||||||
|
|
||||||
/* convolution */
|
#undef DEFINE_PROCESS_FUNC
|
||||||
for (i = 0; i < input_samples; i++) {
|
|
||||||
dst[i] = 0.0;
|
|
||||||
k = i % channels;
|
|
||||||
l = i / channels;
|
|
||||||
for (j = 0; j < kernel_length; j++)
|
|
||||||
if (l < j)
|
|
||||||
dst[i] +=
|
|
||||||
self->residue[(kernel_length + l - j) * channels +
|
|
||||||
k] * self->kernel[j];
|
|
||||||
else
|
|
||||||
dst[i] += src[(l - j) * channels + k] * self->kernel[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy the tail of the current input buffer to the residue, while
|
|
||||||
* keeping parts of the residue if the input buffer is smaller than
|
|
||||||
* the kernel length */
|
|
||||||
if (input_samples < kernel_length * channels)
|
|
||||||
res_start = kernel_length * channels - input_samples;
|
|
||||||
else
|
|
||||||
res_start = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < res_start; i++)
|
|
||||||
self->residue[i] = self->residue[i + input_samples];
|
|
||||||
for (i = res_start; i < kernel_length * channels; i++)
|
|
||||||
self->residue[i] = src[input_samples - kernel_length * channels + i];
|
|
||||||
|
|
||||||
self->residue_length += kernel_length * channels - res_start;
|
|
||||||
if (self->residue_length > kernel_length * channels)
|
|
||||||
self->residue_length = kernel_length * channels;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bpwsinc_build_kernel (GstBPWSinc * self)
|
bpwsinc_build_kernel (GstBPWSinc * self)
|
||||||
|
@ -860,13 +825,13 @@ bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
}
|
}
|
||||||
case PROP_LOWER_FREQUENCY:
|
case PROP_LOWER_FREQUENCY:
|
||||||
GST_BASE_TRANSFORM_LOCK (self);
|
GST_BASE_TRANSFORM_LOCK (self);
|
||||||
self->lower_frequency = g_value_get_double (value);
|
self->lower_frequency = g_value_get_float (value);
|
||||||
bpwsinc_build_kernel (self);
|
bpwsinc_build_kernel (self);
|
||||||
GST_BASE_TRANSFORM_UNLOCK (self);
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
case PROP_UPPER_FREQUENCY:
|
case PROP_UPPER_FREQUENCY:
|
||||||
GST_BASE_TRANSFORM_LOCK (self);
|
GST_BASE_TRANSFORM_LOCK (self);
|
||||||
self->upper_frequency = g_value_get_double (value);
|
self->upper_frequency = g_value_get_float (value);
|
||||||
bpwsinc_build_kernel (self);
|
bpwsinc_build_kernel (self);
|
||||||
GST_BASE_TRANSFORM_UNLOCK (self);
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
|
@ -899,10 +864,10 @@ bpwsinc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
g_value_set_int (value, self->kernel_length);
|
g_value_set_int (value, self->kernel_length);
|
||||||
break;
|
break;
|
||||||
case PROP_LOWER_FREQUENCY:
|
case PROP_LOWER_FREQUENCY:
|
||||||
g_value_set_double (value, self->lower_frequency);
|
g_value_set_float (value, self->lower_frequency);
|
||||||
break;
|
break;
|
||||||
case PROP_UPPER_FREQUENCY:
|
case PROP_UPPER_FREQUENCY:
|
||||||
g_value_set_double (value, self->upper_frequency);
|
g_value_set_float (value, self->upper_frequency);
|
||||||
break;
|
break;
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
g_value_set_enum (value, self->mode);
|
g_value_set_enum (value, self->mode);
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct _GstBPWSinc {
|
||||||
|
|
||||||
gint mode;
|
gint mode;
|
||||||
gint window;
|
gint window;
|
||||||
gdouble lower_frequency, upper_frequency;
|
gfloat lower_frequency, upper_frequency;
|
||||||
gint kernel_length; /* length of the filter kernel */
|
gint kernel_length; /* length of the filter kernel */
|
||||||
|
|
||||||
gdouble *residue; /* buffer for left-over samples from previous buffer */
|
gdouble *residue; /* buffer for left-over samples from previous buffer */
|
||||||
|
|
|
@ -227,15 +227,17 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
|
||||||
gobject_class->get_property = lpwsinc_get_property;
|
gobject_class->get_property = lpwsinc_get_property;
|
||||||
gobject_class->dispose = gst_lpwsinc_dispose;
|
gobject_class->dispose = gst_lpwsinc_dispose;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_FREQUENCY,
|
|
||||||
g_param_spec_double ("frequency", "Frequency",
|
|
||||||
"Cut-off Frequency (Hz)", 0.0, G_MAXDOUBLE, 0.0,
|
|
||||||
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
|
||||||
|
|
||||||
|
/* FIXME: Don't use the complete possible range but restrict the upper boundary
|
||||||
|
* so automatically generated UIs can use a slider */
|
||||||
|
g_object_class_install_property (gobject_class, PROP_FREQUENCY,
|
||||||
|
g_param_spec_float ("cutoff", "Cutoff",
|
||||||
|
"Cut-off Frequency (Hz)", 0.0, 100000.0, 0.0,
|
||||||
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
||||||
g_object_class_install_property (gobject_class, PROP_LENGTH,
|
g_object_class_install_property (gobject_class, PROP_LENGTH,
|
||||||
g_param_spec_int ("length", "Length",
|
g_param_spec_int ("length", "Length",
|
||||||
"Filter kernel length, will be rounded to the next odd number",
|
"Filter kernel length, will be rounded to the next odd number",
|
||||||
3, G_MAXINT, 101, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
3, 50000, 101, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MODE,
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
||||||
g_param_spec_enum ("mode", "Mode",
|
g_param_spec_enum ("mode", "Mode",
|
||||||
|
@ -261,7 +263,7 @@ gst_lpwsinc_init (GstLPWSinc * self, GstLPWSincClass * g_class)
|
||||||
self->window = WINDOW_HAMMING;
|
self->window = WINDOW_HAMMING;
|
||||||
self->kernel_length = 101;
|
self->kernel_length = 101;
|
||||||
self->latency = 50;
|
self->latency = 50;
|
||||||
self->frequency = 0.0;
|
self->cutoff = 0.0;
|
||||||
self->kernel = NULL;
|
self->kernel = NULL;
|
||||||
self->residue = NULL;
|
self->residue = NULL;
|
||||||
|
|
||||||
|
@ -275,86 +277,51 @@ gst_lpwsinc_init (GstLPWSinc * self, GstLPWSincClass * g_class)
|
||||||
lpwsinc_query_type);
|
lpwsinc_query_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
#define DEFINE_PROCESS_FUNC(width,ctype) \
|
||||||
process_32 (GstLPWSinc * self, gfloat * src, gfloat * dst, guint input_samples)
|
static void \
|
||||||
{
|
process_##width (GstLPWSinc * self, g##ctype * src, g##ctype * dst, guint input_samples) \
|
||||||
gint kernel_length = self->kernel_length;
|
{ \
|
||||||
gint i, j, k, l;
|
gint kernel_length = self->kernel_length; \
|
||||||
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
gint i, j, k, l; \
|
||||||
gint res_start;
|
gint channels = GST_AUDIO_FILTER (self)->format.channels; \
|
||||||
|
gint res_start; \
|
||||||
/* convolution */
|
\
|
||||||
for (i = 0; i < input_samples; i++) {
|
/* convolution */ \
|
||||||
dst[i] = 0.0;
|
for (i = 0; i < input_samples; i++) { \
|
||||||
k = i % channels;
|
dst[i] = 0.0; \
|
||||||
l = i / channels;
|
k = i % channels; \
|
||||||
for (j = 0; j < kernel_length; j++)
|
l = i / channels; \
|
||||||
if (l < j)
|
for (j = 0; j < kernel_length; j++) \
|
||||||
dst[i] +=
|
if (l < j) \
|
||||||
self->residue[(kernel_length + l - j) * channels +
|
dst[i] += \
|
||||||
k] * self->kernel[j];
|
self->residue[(kernel_length + l - j) * channels + \
|
||||||
else
|
k] * self->kernel[j]; \
|
||||||
dst[i] += src[(l - j) * channels + k] * self->kernel[j];
|
else \
|
||||||
}
|
dst[i] += src[(l - j) * channels + k] * self->kernel[j]; \
|
||||||
|
} \
|
||||||
/* copy the tail of the current input buffer to the residue, while
|
\
|
||||||
* keeping parts of the residue if the input buffer is smaller than
|
/* copy the tail of the current input buffer to the residue, while \
|
||||||
* the kernel length */
|
* keeping parts of the residue if the input buffer is smaller than \
|
||||||
if (input_samples < kernel_length * channels)
|
* the kernel length */ \
|
||||||
res_start = kernel_length * channels - input_samples;
|
if (input_samples < kernel_length * channels) \
|
||||||
else
|
res_start = kernel_length * channels - input_samples; \
|
||||||
res_start = 0;
|
else \
|
||||||
|
res_start = 0; \
|
||||||
for (i = 0; i < res_start; i++)
|
\
|
||||||
self->residue[i] = self->residue[i + input_samples];
|
for (i = 0; i < res_start; i++) \
|
||||||
for (i = res_start; i < kernel_length * channels; i++)
|
self->residue[i] = self->residue[i + input_samples]; \
|
||||||
self->residue[i] = src[input_samples - kernel_length * channels + i];
|
for (i = res_start; i < kernel_length * channels; i++) \
|
||||||
|
self->residue[i] = src[input_samples - kernel_length * channels + i]; \
|
||||||
self->residue_length += kernel_length * channels - res_start;
|
\
|
||||||
if (self->residue_length > kernel_length * channels)
|
self->residue_length += kernel_length * channels - res_start; \
|
||||||
self->residue_length = kernel_length * channels;
|
if (self->residue_length > kernel_length * channels) \
|
||||||
|
self->residue_length = kernel_length * channels; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
DEFINE_PROCESS_FUNC (32, float);
|
||||||
process_64 (GstLPWSinc * self, gdouble * src, gdouble * dst,
|
DEFINE_PROCESS_FUNC (64, double);
|
||||||
guint input_samples)
|
|
||||||
{
|
|
||||||
gint kernel_length = self->kernel_length;
|
|
||||||
gint i, j, k, l;
|
|
||||||
gint channels = GST_AUDIO_FILTER (self)->format.channels;
|
|
||||||
gint res_start;
|
|
||||||
|
|
||||||
/* convolution */
|
#undef DEFINE_PROCESS_FUNC
|
||||||
for (i = 0; i < input_samples; i++) {
|
|
||||||
dst[i] = 0.0;
|
|
||||||
k = i % channels;
|
|
||||||
l = i / channels;
|
|
||||||
for (j = 0; j < kernel_length; j++)
|
|
||||||
if (l < j)
|
|
||||||
dst[i] +=
|
|
||||||
self->residue[(kernel_length + l - j) * channels +
|
|
||||||
k] * self->kernel[j];
|
|
||||||
else
|
|
||||||
dst[i] += src[(l - j) * channels + k] * self->kernel[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy the tail of the current input buffer to the residue, while
|
|
||||||
* keeping parts of the residue if the input buffer is smaller than
|
|
||||||
* the kernel length */
|
|
||||||
if (input_samples < kernel_length * channels)
|
|
||||||
res_start = kernel_length * channels - input_samples;
|
|
||||||
else
|
|
||||||
res_start = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < res_start; i++)
|
|
||||||
self->residue[i] = self->residue[i + input_samples];
|
|
||||||
for (i = res_start; i < kernel_length * channels; i++)
|
|
||||||
self->residue[i] = src[input_samples - kernel_length * channels + i];
|
|
||||||
|
|
||||||
self->residue_length += kernel_length * channels - res_start;
|
|
||||||
if (self->residue_length > kernel_length * channels)
|
|
||||||
self->residue_length = kernel_length * channels;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lpwsinc_build_kernel (GstLPWSinc * self)
|
lpwsinc_build_kernel (GstLPWSinc * self)
|
||||||
|
@ -377,17 +344,17 @@ lpwsinc_build_kernel (GstLPWSinc * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clamp cutoff frequency between 0 and the nyquist frequency */
|
/* Clamp cutoff frequency between 0 and the nyquist frequency */
|
||||||
self->frequency =
|
self->cutoff =
|
||||||
CLAMP (self->frequency, 0.0, GST_AUDIO_FILTER (self)->format.rate / 2);
|
CLAMP (self->cutoff, 0.0, GST_AUDIO_FILTER (self)->format.rate / 2);
|
||||||
|
|
||||||
GST_DEBUG ("lpwsinc: initializing filter kernel of length %d "
|
GST_DEBUG ("lpwsinc: initializing filter kernel of length %d "
|
||||||
"with cutoff %.2lf Hz "
|
"with cutoff %.2lf Hz "
|
||||||
"for mode %s",
|
"for mode %s",
|
||||||
len, self->frequency,
|
len, self->cutoff,
|
||||||
(self->mode == MODE_LOW_PASS) ? "low-pass" : "high-pass");
|
(self->mode == MODE_LOW_PASS) ? "low-pass" : "high-pass");
|
||||||
|
|
||||||
/* fill the kernel */
|
/* fill the kernel */
|
||||||
w = 2 * M_PI * (self->frequency / GST_AUDIO_FILTER (self)->format.rate);
|
w = 2 * M_PI * (self->cutoff / GST_AUDIO_FILTER (self)->format.rate);
|
||||||
|
|
||||||
if (self->kernel)
|
if (self->kernel)
|
||||||
g_free (self->kernel);
|
g_free (self->kernel);
|
||||||
|
@ -800,7 +767,7 @@ lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
}
|
}
|
||||||
case PROP_FREQUENCY:
|
case PROP_FREQUENCY:
|
||||||
GST_BASE_TRANSFORM_LOCK (self);
|
GST_BASE_TRANSFORM_LOCK (self);
|
||||||
self->frequency = g_value_get_double (value);
|
self->cutoff = g_value_get_float (value);
|
||||||
lpwsinc_build_kernel (self);
|
lpwsinc_build_kernel (self);
|
||||||
GST_BASE_TRANSFORM_UNLOCK (self);
|
GST_BASE_TRANSFORM_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
|
@ -833,7 +800,7 @@ lpwsinc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
g_value_set_int (value, self->kernel_length);
|
g_value_set_int (value, self->kernel_length);
|
||||||
break;
|
break;
|
||||||
case PROP_FREQUENCY:
|
case PROP_FREQUENCY:
|
||||||
g_value_set_double (value, self->frequency);
|
g_value_set_float (value, self->cutoff);
|
||||||
break;
|
break;
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
g_value_set_enum (value, self->mode);
|
g_value_set_enum (value, self->mode);
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct _GstLPWSinc {
|
||||||
|
|
||||||
gint mode;
|
gint mode;
|
||||||
gint window;
|
gint window;
|
||||||
gdouble frequency;
|
gfloat cutoff;
|
||||||
gint kernel_length; /* length of the filter kernel */
|
gint kernel_length; /* length of the filter kernel */
|
||||||
|
|
||||||
gdouble *residue; /* buffer for left-over samples from previous buffer */
|
gdouble *residue; /* buffer for left-over samples from previous buffer */
|
||||||
|
|
|
@ -108,7 +108,7 @@ GST_START_TEST (test_lp_0hz)
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
/* cutoff = sampling rate / 4, data = 0 */
|
/* cutoff = sampling rate / 4, data = 0 */
|
||||||
g_object_set (G_OBJECT (lpwsinc), "frequency", 44100 / 4.0, NULL);
|
g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
||||||
for (i = 0; i < 128; i++)
|
for (i = 0; i < 128; i++)
|
||||||
|
@ -166,7 +166,7 @@ GST_START_TEST (test_lp_22050hz)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
g_object_set (G_OBJECT (lpwsinc), "frequency", 44100 / 4.0, NULL);
|
g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
||||||
for (i = 0; i < 128; i += 2) {
|
for (i = 0; i < 128; i += 2) {
|
||||||
|
@ -226,7 +226,7 @@ GST_START_TEST (test_hp_0hz)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
g_object_set (G_OBJECT (lpwsinc), "frequency", 44100 / 4.0, NULL);
|
g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
||||||
for (i = 0; i < 128; i++)
|
for (i = 0; i < 128; i++)
|
||||||
|
@ -284,7 +284,7 @@ GST_START_TEST (test_hp_22050hz)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
g_object_set (G_OBJECT (lpwsinc), "frequency", 44100 / 4.0, NULL);
|
g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
||||||
for (i = 0; i < 128; i += 2) {
|
for (i = 0; i < 128; i += 2) {
|
||||||
|
@ -344,7 +344,7 @@ GST_START_TEST (test_small_buffer)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
g_object_set (G_OBJECT (lpwsinc), "frequency", 44100 / 4.0, NULL);
|
g_object_set (G_OBJECT (lpwsinc), "cutoff", 44100 / 4.0, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
||||||
for (i = 0; i < 20; i++)
|
for (i = 0; i < 20; i++)
|
||||||
|
|
Loading…
Reference in a new issue