Commit graph

17 commits

Author SHA1 Message Date
Sebastian Dröge a9a5e0c7e1 audiofxbasefirfilter: Add property for not draining the history on kernel changes
Currently this only works if the kernel size doesn't change, in the future
it will be possible to change the kernel size too without draining
the complete history and without loosing anything.

Partially based on a patch by
Thiago Santos <thiago.sousa.santos@collabora.co.uk>
2010-01-07 17:28:43 +01:00
Thiago Santos 173be1422c audiofxbasefirfilter: do not try to alloc really large buffers
When nsamples_out is larger than nsamples_in, using unsigned
ints lead to a overflow and the resulting value is wrong and
way too large for allocating a buffer. Use signed integers
and returning immediatelly when that happens.
2009-12-26 16:59:14 -03:00
Sebastian Dröge 119a6ce637 audiofxbasefirfilter: Fix frequency response calculation 2009-12-15 18:12:47 +01:00
Sebastian Dröge 8695581751 audiofxbasefirfilter: Remove dead assignments 2009-12-15 18:12:46 +01:00
Sebastian Dröge cd2b1c1b58 audiofxbasefirfilter: Add special processing functions for Mono/Stereo
This provides another 7% speedup for the time domain convolution and 1.5%
speedup for the FFT convolution on Mono input.

This optimization assumes that the compiler simplifies calculations
and conditions on constant numbers and unrolls loops with a constant
number of repeats.
2009-12-15 18:12:46 +01:00
Sebastian Dröge a3d7321c50 audiofxbasefirfilter: Add a "low-latency" mode
This will always use time-domain convolution, which lowers the latency.
With FFT convolution it's always a multiple of the kernel length,
with time domain convolution it's only the pre-latency of the filter kernel.
2009-12-15 18:12:46 +01:00
Sebastian Dröge ca568ff079 audiofxbasefirfilter: Remove obsolete TODO comments 2009-12-15 18:12:46 +01:00
Sebastian Dröge 45edc1bbd8 audiofxbasefirfilter: Use samples everywhere instead of samples*channels sometimes 2009-12-15 18:12:46 +01:00
Sebastian Dröge 02960383c1 audiofxbasefirfilter: FFT convolution implementation
This provides a great speedup, especially the relationship between kernel
length and processing size is now logarithmic instead of linear. Below a
kernel size of 32 it's a bit slower, afterwards it's much faster:

17     0.788000 -> 0.950000
33     1.208000 -> 1.146000
65     2.166000 -> 1.146000
...
4097 107.444000 -> 1.508000

For sizes smaller 32 the normal time-domain convolution is chosen,
for larger sizes the FFT convolution is automatically used.

Fixes bug #594381.
2009-12-15 18:12:46 +01:00
Sebastian Dröge ddafc20b28 audiofxbasefirfilter: Make most code parts independent of the processing functions and used convolution algorithm
Only remaining part is the residue pushing, which will be fixed later.
2009-12-15 18:12:46 +01:00
Sebastian Dröge 43576fb0cf audiofxbasefirfilter: Optimize time-domain convolution
Remove some redundant calculations, move comparisions out of
inner loops, etc.

This makes the convolution about 3 (!) times faster but
processing time is of course still proportional to the
filter size.
2009-12-15 18:12:46 +01:00
Sebastian Dröge c5f955a3b6 audiofxbasefirfilter: Use _CAST macros in some places and do some calculations only once 2009-12-15 18:12:46 +01:00
Sebastian Dröge abb437454e audiofxbasefirfilter: Rewrite timestamp tracking
It's much simpler now and doesn't introduce accumulating rounding
errors.
2009-12-15 18:12:46 +01:00
Sebastian Dröge c57be62881 audiofxbasefirfilter: Rename some variables and change comments 2009-12-15 18:12:45 +01:00
Sebastian Dröge 742a7c7f50 audiofxbasefirfilter: Add const qualifier to the source data array 2009-12-15 18:12:45 +01:00
Josep Torra 00aa3421e0 audiofx: use G_GUINT64_FORMAT to fix warnings on OSX 2009-10-09 11:43:44 +02:00
Sebastian Dröge 0016658ace gst/audiofx/: Implement a base class for generic audio FIR filters.
Original commit message from CVS:
* gst/audiofx/Makefile.am:
* gst/audiofx/audiofxbasefirfilter.c:
(gst_audio_fx_base_fir_filter_dispose),
(gst_audio_fx_base_fir_filter_base_init),
(gst_audio_fx_base_fir_filter_class_init),
(gst_audio_fx_base_fir_filter_init),
(gst_audio_fx_base_fir_filter_push_residue),
(gst_audio_fx_base_fir_filter_setup),
(gst_audio_fx_base_fir_filter_transform),
(gst_audio_fx_base_fir_filter_start),
(gst_audio_fx_base_fir_filter_stop),
(gst_audio_fx_base_fir_filter_query),
(gst_audio_fx_base_fir_filter_query_type),
(gst_audio_fx_base_fir_filter_event),
(gst_audio_fx_base_fir_filter_set_kernel):
* gst/audiofx/audiofxbasefirfilter.h:
* gst/audiofx/audiofxbaseiirfilter.c:
Implement a base class for generic audio FIR filters.
* gst/audiofx/audiowsincband.c:
(gst_gst_audio_wsincband_mode_get_type),
(gst_gst_audio_wsincband_window_get_type),
(gst_audio_wsincband_base_init), (gst_audio_wsincband_class_init),
(gst_audio_wsincband_init), (gst_audio_wsincband_build_kernel),
(gst_audio_wsincband_setup), (gst_audio_wsincband_set_property),
(gst_audio_wsincband_get_property):
* gst/audiofx/audiowsincband.h:
* gst/audiofx/audiowsinclimit.c:
(gst_audio_wsinclimit_mode_get_type),
(gst_audio_wsinclimit_window_get_type),
(gst_audio_wsinclimit_base_init),
(gst_audio_wsinclimit_class_init), (gst_audio_wsinclimit_init),
(gst_audio_wsinclimit_build_kernel), (gst_audio_wsinclimit_setup),
(gst_audio_wsinclimit_set_property),
(gst_audio_wsinclimit_get_property):
* gst/audiofx/audiowsinclimit.h:
* tests/check/elements/audiowsincband.c: (GST_START_TEST):
* tests/check/elements/audiowsinclimit.c: (GST_START_TEST):
Use this new base class for audiowsincband and audiowsinclimit.
Also cleanup both elements.
2009-01-11 19:03:38 +00:00