mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +00:00
129c7e8af1
Original commit message from CVS: * configure.ac: Remove idct and resample libs * gst-libs/gst/Makefile.am: same Remove usage of gst_library_load(): * ext/alsa/gstalsaplugin.c: (plugin_init): * ext/libvisual/visual.c: (plugin_init): * ext/ogg/gstogg.c: (plugin_init): * ext/theora/theora.c: (plugin_init): * ext/vorbis/vorbis.c: (plugin_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (plugin_init): * gst/audioscale/gstaudioscale.c: * gst/adder/gstadder.c: (plugin_init): * gst/audioconvert/plugin.c: (plugin_init): * sys/ximage/ximagesink.c: (plugin_init): * sys/xvimage/xvimagesink.c: (plugin_init): * gst/tcp/gsttcpplugin.c: (plugin_init): Link plugins against libraries: * ext/ogg/Makefile.am: * ext/theora/Makefile.am: * ext/vorbis/Makefile.am: * gst/audioconvert/Makefile.am: Create proper libraries: * gst-libs/gst/riff/Makefile.am: * gst-libs/gst/audio/Makefile.am: * gst-libs/gst/video/Makefile.am: Move resample library to audioscale plugin directory: * gst-libs/gst/resample/Makefile.am: * gst-libs/gst/resample/README: * gst-libs/gst/resample/dtof.c: * gst-libs/gst/resample/dtos.c: * gst-libs/gst/resample/functable.c: * gst-libs/gst/resample/private.h: * gst-libs/gst/resample/resample.c: * gst-libs/gst/resample/resample.h: * gst-libs/gst/resample/resample.vcproj: * gst-libs/gst/resample/test.c: * gst/audioscale/Makefile.am: * gst/audioscale/README: * gst/audioscale/dtof.c: * gst/audioscale/dtos.c: * gst/audioscale/functable.c: * gst/audioscale/private.h: * gst/audioscale/resample.c: * gst/audioscale/resample.h: * gst/audioscale/test.c: Move tagedit library to gst-libs: * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3tag.c: * gst-libs/gst/tag/gsttagediting.c: * gst-libs/gst/tag/gsttageditingprivate.h: * gst-libs/gst/tag/gstvorbistag.c: * gst/tags/Makefile.am: * gst/tags/gstid3tag.c: * gst/tags/gstvorbistag.c: Fix for core changes: * gst/sine/gstsinesrc.c: (gst_sinesrc_class_init), (gst_sinesrc_init), (gst_sinesrc_src_fixate), (gst_sinesrc_link), (gst_sinesrc_getrange):
62 lines
2.5 KiB
Text
62 lines
2.5 KiB
Text
|
|
This is a snapshot of my current work developing an audio
|
|
resampling library. While working on this library, I started
|
|
writing lots of general purpose functions that should really
|
|
be part of a larger library. Rather than have a constantly
|
|
changing library, and since the current code is capable, I
|
|
decided to freeze this codebase for use with gstreamer, and
|
|
move active development of the code elsewhere.
|
|
|
|
The algorithm used is based on Shannon's theorem, which says
|
|
that you can recreate an input signal from equidistant samples
|
|
using a sin(x)/x filter; thus, you can create new samples from
|
|
the regenerated input signal. Since sin(x)/x is expensive to
|
|
evaluate, an interpolated lookup table is used. Also, a
|
|
windowing function (1-x^2)^2 is used, which aids the convergence
|
|
of sin(x)/x for lower frequencies at the expense of higher.
|
|
|
|
There is one tunable parameter, which is the filter length.
|
|
Longer filter lengths are obviously slower, but more accurate.
|
|
There's not much reason to use a filter length longer than 64,
|
|
since other approximations start to dominate. Filter lengths
|
|
as short as 8 are audially acceptable, but should not be
|
|
considered for serious work.
|
|
|
|
Performance: A PowerPC G4 at 400 Mhz can resample 2 audio
|
|
channels at almost 10x speed with a filter length of 64, without
|
|
using Altivec extensions. (My goal was 10x speed, which I almost
|
|
reached. Maybe later.)
|
|
|
|
Limitations: Currently only supports streams in the form of
|
|
interleaved signed 16-bit samples.
|
|
|
|
The test.c program is a simple regression test. It creates a
|
|
test input pattern (1 sec at 48 khz) that is a frequency ramp
|
|
from 0 to 24000 hz, and then converts it to 44100 hz using a
|
|
filter length of 64. It then compares the result to the same
|
|
pattern generated at 44100 hz, and outputs the result to the
|
|
file "out".
|
|
|
|
A graph of the correct output should have field 2 and field 4
|
|
almost equal (plus/minus 1) up to about sample 40000 (which
|
|
corresponds to 20 khz), and then field 2 should be close to 0
|
|
above that. Running the test program will print to stdout
|
|
something like the following:
|
|
|
|
time 0.112526
|
|
average error 10k=0.4105 22k=639.34
|
|
|
|
The average error is RMS error over the range [0-10khz] and
|
|
[0-22khz], and is expressed in sample values, for an input
|
|
amplitude of 16000. Note that RMS errors below 1.0 can't
|
|
really be compared, but basically this shows that below
|
|
10 khz, the resampler is nearly perfect. Most of the error
|
|
is concentrated above 20 khz.
|
|
|
|
If the average error is significantly larger after modifying
|
|
the code, it's probably not good.
|
|
|
|
|
|
|
|
dave...
|
|
|