gst/audiofx/: Use generator macros for the process functions for the different sample types, add lower upper boundari...

Original commit message from CVS:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_class_init):
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_class_init):
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 add a note about
the number of poles as a too high number of poles combined with
very low or very high frequencies will produce only noise.
* docs/plugins/gst-plugins-good-plugins.args:
Regenerated for the property changes.
This commit is contained in:
Sebastian Dröge 2007-08-17 14:43:33 +00:00
parent 6ef7055041
commit f86bfaf5f9
6 changed files with 143 additions and 123 deletions

View file

@ -1,3 +1,17 @@
2007-08-17 Sebastian Dröge <slomo@circular-chaos.org>
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_class_init):
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_class_init):
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 add a note about
the number of poles as a too high number of poles combined with
very low or very high frequencies will produce only noise.
* docs/plugins/gst-plugins-good-plugins.args:
Regenerated for the property changes.
2007-08-17 Wim Taymans <wim.taymans@gmail.com> 2007-08-17 Wim Taymans <wim.taymans@gmail.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_set_property), * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_set_property),

View file

@ -401,21 +401,21 @@
<ARG> <ARG>
<NAME>GstVertigoTV::speed</NAME> <NAME>GstVertigoTV::speed</NAME>
<TYPE>gfloat</TYPE> <TYPE>gfloat</TYPE>
<RANGE>[0.01,100]</RANGE> <RANGE>[0,01,100]</RANGE>
<FLAGS>rw</FLAGS> <FLAGS>rw</FLAGS>
<NICK>Speed</NICK> <NICK>Speed</NICK>
<BLURB>Control the speed of movement.</BLURB> <BLURB>Control the speed of movement.</BLURB>
<DEFAULT>0.02</DEFAULT> <DEFAULT>0,02</DEFAULT>
</ARG> </ARG>
<ARG> <ARG>
<NAME>GstVertigoTV::zoom-speed</NAME> <NAME>GstVertigoTV::zoom-speed</NAME>
<TYPE>gfloat</TYPE> <TYPE>gfloat</TYPE>
<RANGE>[1.01,1.1]</RANGE> <RANGE>[1,01,1,1]</RANGE>
<FLAGS>rw</FLAGS> <FLAGS>rw</FLAGS>
<NICK>Zoom Speed</NICK> <NICK>Zoom Speed</NICK>
<BLURB>Control the rate of zooming.</BLURB> <BLURB>Control the rate of zooming.</BLURB>
<DEFAULT>1.01</DEFAULT> <DEFAULT>1,01</DEFAULT>
</ARG> </ARG>
<ARG> <ARG>
@ -17241,7 +17241,7 @@
<ARG> <ARG>
<NAME>GstGamma::gamma</NAME> <NAME>GstGamma::gamma</NAME>
<TYPE>gdouble</TYPE> <TYPE>gdouble</TYPE>
<RANGE>[0.01,10]</RANGE> <RANGE>[0,01,10]</RANGE>
<FLAGS>rw</FLAGS> <FLAGS>rw</FLAGS>
<NICK>Gamma</NICK> <NICK>Gamma</NICK>
<BLURB>gamma.</BLURB> <BLURB>gamma.</BLURB>
@ -17365,7 +17365,7 @@
<FLAGS>rw</FLAGS> <FLAGS>rw</FLAGS>
<NICK>Ripple</NICK> <NICK>Ripple</NICK>
<BLURB>Amount of ripple (dB).</BLURB> <BLURB>Amount of ripple (dB).</BLURB>
<DEFAULT>0.25</DEFAULT> <DEFAULT>0,25</DEFAULT>
</ARG> </ARG>
<ARG> <ARG>
@ -17391,7 +17391,7 @@
<ARG> <ARG>
<NAME>GstAudioChebyshevFreqLimit::cutoff</NAME> <NAME>GstAudioChebyshevFreqLimit::cutoff</NAME>
<TYPE>gfloat</TYPE> <TYPE>gfloat</TYPE>
<RANGE>>= 0</RANGE> <RANGE>[0,100000]</RANGE>
<FLAGS>rw</FLAGS> <FLAGS>rw</FLAGS>
<NICK>Cutoff</NICK> <NICK>Cutoff</NICK>
<BLURB>Cut off frequency (Hz).</BLURB> <BLURB>Cut off frequency (Hz).</BLURB>
@ -17421,11 +17421,11 @@
<ARG> <ARG>
<NAME>GstAudioChebyshevFreqLimit::ripple</NAME> <NAME>GstAudioChebyshevFreqLimit::ripple</NAME>
<TYPE>gfloat</TYPE> <TYPE>gfloat</TYPE>
<RANGE>>= 0</RANGE> <RANGE>[0,200]</RANGE>
<FLAGS>rw</FLAGS> <FLAGS>rw</FLAGS>
<NICK>Ripple</NICK> <NICK>Ripple</NICK>
<BLURB>Amount of ripple (dB).</BLURB> <BLURB>Amount of ripple (dB).</BLURB>
<DEFAULT>0.25</DEFAULT> <DEFAULT>0,25</DEFAULT>
</ARG> </ARG>
<ARG> <ARG>

View file

@ -53,6 +53,10 @@
* <para> * <para>
* As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter. * As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter.
* </para> * </para>
* <para><note>
* Be warned that a too large number of poles can produce noise. The most poles are possible with
* a cutoff frequency at a quarter of the sampling rate.
* </note></para>
* <title>Example launch line</title> * <title>Example launch line</title>
* <para> * <para>
* <programlisting> * <programlisting>
@ -233,18 +237,24 @@ gst_audio_chebyshev_freq_band_class_init (GstAudioChebyshevFreqBandClass *
g_param_spec_int ("type", "Type", g_param_spec_int ("type", "Type",
"Type of the chebychev filter", 1, 2, "Type of the chebychev filter", 1, 2,
1, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 1, 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 without */
g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY, g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY,
g_param_spec_float ("lower-frequency", "Lower frequency", g_param_spec_float ("lower-frequency", "Lower frequency",
"Start frequency of the band (Hz)", 0.0, G_MAXFLOAT, "Start frequency of the band (Hz)", 0.0, 100000.0,
0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY, g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY,
g_param_spec_float ("upper-frequency", "Upper frequency", g_param_spec_float ("upper-frequency", "Upper frequency",
"Stop frequency of the band (Hz)", 0.0, G_MAXFLOAT, "Stop frequency of the band (Hz)", 0.0, 100000.0,
0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_RIPPLE, g_object_class_install_property (gobject_class, PROP_RIPPLE,
g_param_spec_float ("ripple", "Ripple", g_param_spec_float ("ripple", "Ripple",
"Amount of ripple (dB)", 0.0, G_MAXFLOAT, "Amount of ripple (dB)", 0.0, 200.0,
0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
/* FIXME: What to do about this upper boundary? With a frequencies near
* rate/4 32 poles are completely possible, with frequencies very low
* or very high 16 poles already produces only noise */
g_object_class_install_property (gobject_class, PROP_POLES, g_object_class_install_property (gobject_class, PROP_POLES,
g_param_spec_int ("poles", "Poles", g_param_spec_int ("poles", "Poles",
"Number of poles to use, will be rounded up to the next multiply of four", "Number of poles to use, will be rounded up to the next multiply of four",
@ -840,35 +850,26 @@ process (GstAudioChebyshevFreqBand * filter,
return val; return val;
} }
static void #define DEFINE_PROCESS_FUNC(width,ctype) \
process_64 (GstAudioChebyshevFreqBand * filter, static void \
gdouble * data, guint num_samples) process_##width (GstAudioChebyshevFreqBand * filter, \
{ g##ctype * data, guint num_samples) \
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; { \
gdouble val; gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
gdouble val; \
for (i = 0; i < num_samples / channels; i++) { \
for (j = 0; j < channels; j++) { for (i = 0; i < num_samples / channels; i++) { \
val = process (filter, &filter->channels[j], *data); for (j = 0; j < channels; j++) { \
*data++ = val; val = process (filter, &filter->channels[j], *data); \
} *data++ = val; \
} } \
} \
} }
static void DEFINE_PROCESS_FUNC (32, float);
process_32 (GstAudioChebyshevFreqBand * filter, DEFINE_PROCESS_FUNC (64, double);
gfloat * data, guint num_samples)
{
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels;
gdouble val;
for (i = 0; i < num_samples / channels; i++) { #undef DEFINE_PROCESS_FUNC
for (j = 0; j < channels; j++) {
val = process (filter, &filter->channels[j], *data);
*data++ = val;
}
}
}
/* GstBaseTransform vmethod implementations */ /* GstBaseTransform vmethod implementations */
static GstFlowReturn static GstFlowReturn

View file

@ -49,6 +49,10 @@
* <para> * <para>
* As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter. * As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter.
* </para> * </para>
* <para><note>
* Be warned that a too large number of poles can produce noise. The most poles are possible with
* a cutoff frequency at a quarter of the sampling rate.
* </note></para>
* <title>Example launch line</title> * <title>Example launch line</title>
* <para> * <para>
* <programlisting> * <programlisting>
@ -229,12 +233,19 @@ gst_audio_chebyshev_freq_limit_class_init (GstAudioChebyshevFreqLimitClass *
g_object_class_install_property (gobject_class, PROP_TYPE, g_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_int ("type", "Type", "Type of the chebychev filter", 1, 2, 1, g_param_spec_int ("type", "Type", "Type of the chebychev filter", 1, 2, 1,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 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 without */
g_object_class_install_property (gobject_class, PROP_CUTOFF, g_object_class_install_property (gobject_class, PROP_CUTOFF,
g_param_spec_float ("cutoff", "Cutoff", "Cut off frequency (Hz)", 0.0, g_param_spec_float ("cutoff", "Cutoff", "Cut off frequency (Hz)", 0.0,
G_MAXFLOAT, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 100000.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_RIPPLE, g_object_class_install_property (gobject_class, PROP_RIPPLE,
g_param_spec_float ("ripple", "Ripple", "Amount of ripple (dB)", 0.0, g_param_spec_float ("ripple", "Ripple", "Amount of ripple (dB)", 0.0,
G_MAXFLOAT, 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 200.0, 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
/* FIXME: What to do about this upper boundary? With a cutoff frequency of
* rate/4 32 poles are completely possible, with a cutoff frequency very low
* or very high 16 poles already produces only noise */
g_object_class_install_property (gobject_class, PROP_POLES, g_object_class_install_property (gobject_class, PROP_POLES,
g_param_spec_int ("poles", "Poles", g_param_spec_int ("poles", "Poles",
"Number of poles to use, will be rounded up to the next even number", "Number of poles to use, will be rounded up to the next even number",
@ -739,35 +750,26 @@ process (GstAudioChebyshevFreqLimit * filter,
return val; return val;
} }
static void #define DEFINE_PROCESS_FUNC(width,ctype) \
process_64 (GstAudioChebyshevFreqLimit * filter, static void \
gdouble * data, guint num_samples) process_##width (GstAudioChebyshevFreqLimit * filter, \
{ g##ctype * data, guint num_samples) \
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; { \
gdouble val; gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
gdouble val; \
for (i = 0; i < num_samples / channels; i++) { \
for (j = 0; j < channels; j++) { for (i = 0; i < num_samples / channels; i++) { \
val = process (filter, &filter->channels[j], *data); for (j = 0; j < channels; j++) { \
*data++ = val; val = process (filter, &filter->channels[j], *data); \
} *data++ = val; \
} } \
} \
} }
static void DEFINE_PROCESS_FUNC (32, float);
process_32 (GstAudioChebyshevFreqLimit * filter, DEFINE_PROCESS_FUNC (64, double);
gfloat * data, guint num_samples)
{
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels;
gdouble val;
for (i = 0; i < num_samples / channels; i++) { #undef DEFINE_PROCESS_FUNC
for (j = 0; j < channels; j++) {
val = process (filter, &filter->channels[j], *data);
*data++ = val;
}
}
}
/* GstBaseTransform vmethod implementations */ /* GstBaseTransform vmethod implementations */
static GstFlowReturn static GstFlowReturn

View file

@ -53,6 +53,10 @@
* <para> * <para>
* As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter. * As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter.
* </para> * </para>
* <para><note>
* Be warned that a too large number of poles can produce noise. The most poles are possible with
* a cutoff frequency at a quarter of the sampling rate.
* </note></para>
* <title>Example launch line</title> * <title>Example launch line</title>
* <para> * <para>
* <programlisting> * <programlisting>
@ -233,18 +237,24 @@ gst_audio_chebyshev_freq_band_class_init (GstAudioChebyshevFreqBandClass *
g_param_spec_int ("type", "Type", g_param_spec_int ("type", "Type",
"Type of the chebychev filter", 1, 2, "Type of the chebychev filter", 1, 2,
1, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 1, 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 without */
g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY, g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY,
g_param_spec_float ("lower-frequency", "Lower frequency", g_param_spec_float ("lower-frequency", "Lower frequency",
"Start frequency of the band (Hz)", 0.0, G_MAXFLOAT, "Start frequency of the band (Hz)", 0.0, 100000.0,
0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY, g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY,
g_param_spec_float ("upper-frequency", "Upper frequency", g_param_spec_float ("upper-frequency", "Upper frequency",
"Stop frequency of the band (Hz)", 0.0, G_MAXFLOAT, "Stop frequency of the band (Hz)", 0.0, 100000.0,
0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_RIPPLE, g_object_class_install_property (gobject_class, PROP_RIPPLE,
g_param_spec_float ("ripple", "Ripple", g_param_spec_float ("ripple", "Ripple",
"Amount of ripple (dB)", 0.0, G_MAXFLOAT, "Amount of ripple (dB)", 0.0, 200.0,
0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
/* FIXME: What to do about this upper boundary? With a frequencies near
* rate/4 32 poles are completely possible, with frequencies very low
* or very high 16 poles already produces only noise */
g_object_class_install_property (gobject_class, PROP_POLES, g_object_class_install_property (gobject_class, PROP_POLES,
g_param_spec_int ("poles", "Poles", g_param_spec_int ("poles", "Poles",
"Number of poles to use, will be rounded up to the next multiply of four", "Number of poles to use, will be rounded up to the next multiply of four",
@ -840,35 +850,26 @@ process (GstAudioChebyshevFreqBand * filter,
return val; return val;
} }
static void #define DEFINE_PROCESS_FUNC(width,ctype) \
process_64 (GstAudioChebyshevFreqBand * filter, static void \
gdouble * data, guint num_samples) process_##width (GstAudioChebyshevFreqBand * filter, \
{ g##ctype * data, guint num_samples) \
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; { \
gdouble val; gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
gdouble val; \
for (i = 0; i < num_samples / channels; i++) { \
for (j = 0; j < channels; j++) { for (i = 0; i < num_samples / channels; i++) { \
val = process (filter, &filter->channels[j], *data); for (j = 0; j < channels; j++) { \
*data++ = val; val = process (filter, &filter->channels[j], *data); \
} *data++ = val; \
} } \
} \
} }
static void DEFINE_PROCESS_FUNC (32, float);
process_32 (GstAudioChebyshevFreqBand * filter, DEFINE_PROCESS_FUNC (64, double);
gfloat * data, guint num_samples)
{
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels;
gdouble val;
for (i = 0; i < num_samples / channels; i++) { #undef DEFINE_PROCESS_FUNC
for (j = 0; j < channels; j++) {
val = process (filter, &filter->channels[j], *data);
*data++ = val;
}
}
}
/* GstBaseTransform vmethod implementations */ /* GstBaseTransform vmethod implementations */
static GstFlowReturn static GstFlowReturn

View file

@ -49,6 +49,10 @@
* <para> * <para>
* As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter. * As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter.
* </para> * </para>
* <para><note>
* Be warned that a too large number of poles can produce noise. The most poles are possible with
* a cutoff frequency at a quarter of the sampling rate.
* </note></para>
* <title>Example launch line</title> * <title>Example launch line</title>
* <para> * <para>
* <programlisting> * <programlisting>
@ -229,12 +233,19 @@ gst_audio_chebyshev_freq_limit_class_init (GstAudioChebyshevFreqLimitClass *
g_object_class_install_property (gobject_class, PROP_TYPE, g_object_class_install_property (gobject_class, PROP_TYPE,
g_param_spec_int ("type", "Type", "Type of the chebychev filter", 1, 2, 1, g_param_spec_int ("type", "Type", "Type of the chebychev filter", 1, 2, 1,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 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 without */
g_object_class_install_property (gobject_class, PROP_CUTOFF, g_object_class_install_property (gobject_class, PROP_CUTOFF,
g_param_spec_float ("cutoff", "Cutoff", "Cut off frequency (Hz)", 0.0, g_param_spec_float ("cutoff", "Cutoff", "Cut off frequency (Hz)", 0.0,
G_MAXFLOAT, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 100000.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_RIPPLE, g_object_class_install_property (gobject_class, PROP_RIPPLE,
g_param_spec_float ("ripple", "Ripple", "Amount of ripple (dB)", 0.0, g_param_spec_float ("ripple", "Ripple", "Amount of ripple (dB)", 0.0,
G_MAXFLOAT, 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 200.0, 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
/* FIXME: What to do about this upper boundary? With a cutoff frequency of
* rate/4 32 poles are completely possible, with a cutoff frequency very low
* or very high 16 poles already produces only noise */
g_object_class_install_property (gobject_class, PROP_POLES, g_object_class_install_property (gobject_class, PROP_POLES,
g_param_spec_int ("poles", "Poles", g_param_spec_int ("poles", "Poles",
"Number of poles to use, will be rounded up to the next even number", "Number of poles to use, will be rounded up to the next even number",
@ -739,35 +750,26 @@ process (GstAudioChebyshevFreqLimit * filter,
return val; return val;
} }
static void #define DEFINE_PROCESS_FUNC(width,ctype) \
process_64 (GstAudioChebyshevFreqLimit * filter, static void \
gdouble * data, guint num_samples) process_##width (GstAudioChebyshevFreqLimit * filter, \
{ g##ctype * data, guint num_samples) \
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; { \
gdouble val; gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
gdouble val; \
for (i = 0; i < num_samples / channels; i++) { \
for (j = 0; j < channels; j++) { for (i = 0; i < num_samples / channels; i++) { \
val = process (filter, &filter->channels[j], *data); for (j = 0; j < channels; j++) { \
*data++ = val; val = process (filter, &filter->channels[j], *data); \
} *data++ = val; \
} } \
} \
} }
static void DEFINE_PROCESS_FUNC (32, float);
process_32 (GstAudioChebyshevFreqLimit * filter, DEFINE_PROCESS_FUNC (64, double);
gfloat * data, guint num_samples)
{
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels;
gdouble val;
for (i = 0; i < num_samples / channels; i++) { #undef DEFINE_PROCESS_FUNC
for (j = 0; j < channels; j++) {
val = process (filter, &filter->channels[j], *data);
*data++ = val;
}
}
}
/* GstBaseTransform vmethod implementations */ /* GstBaseTransform vmethod implementations */
static GstFlowReturn static GstFlowReturn