After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794411 - gstaudioresample: insufficient anti-aliasing
gstaudioresample: insufficient anti-aliasing
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-03-16 21:00 UTC by Aaron Viets
Modified: 2018-11-03 12:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Transfer Function for audioresample (240.42 KB, image/jpeg)
2018-03-20 18:20 UTC, Aaron Viets
Details
audioresample transfer function (199.38 KB, image/jpeg)
2018-03-27 13:18 UTC, Aaron Viets
Details
audioresample transfer function zoomed (120.97 KB, image/jpeg)
2018-03-27 13:19 UTC, Aaron Viets
Details
lal_resample transfer function (214.02 KB, image/jpeg)
2018-03-27 13:20 UTC, Aaron Viets
Details
lal_resample transfer function zoomed (116.41 KB, image/jpeg)
2018-03-27 13:20 UTC, Aaron Viets
Details
audioresample transfer function zoomed only downsample (117.48 KB, image/jpeg)
2018-03-27 13:32 UTC, Aaron Viets
Details
audioresample transfer function zoomed only upsample (123.41 KB, image/jpeg)
2018-03-27 13:34 UTC, Aaron Viets
Details

Description Aaron Viets 2018-03-16 21:00:44 UTC
I am using GStreamer for calibration of LIGO data. After an update from version 1.4.5 to version 1.10.4, I discovered that the anti-aliasing was much lower in quality than before, leading to ~2% systematic errors. I set the property quality = 9, and the rest of the properties were the default values.
Comment 1 Tim-Philipp Müller 2018-03-16 22:47:42 UTC
Could you please also check with the lastest version (1.14 rc2 = 1.13.91) or git master?

And/or make a test case available so we can try it ourselves?
Comment 2 Sebastian Dröge (slomo) 2018-03-19 09:25:37 UTC
Did you also try the different settings (apart from quality)? See https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstAudio.html#GstAudioResamplerFilterInterpolation and everything below it.
Comment 3 Aaron Viets 2018-03-20 18:20:26 UTC
Created attachment 369920 [details]
Transfer Function for audioresample

I used a command line similar to this to generate the data for the attached plot:

gst-launch-1.0 audiotestsrc num-buffers=100 samplesperbuffer=16384 wave=5 ! audio/x-raw,format=F64LE,rate=16384 ! tee name="teeAB" silent=false ! audioresample quality=9 name="B1" ! audio/x-raw,format=F64LE,rate=2048 ! audioresample quality=9 name="B2" ! audio/x-raw,format=F64LE,rate=16384 ! identity name="B3" teeAB. ! identity name="A1" A1. ! lal_nxydump ! filesink location=data.txt async=false B3. ! lal_nxydump ! filesink location=resampled_data.txt async=false

The plot is a transfer function (magnitude and phase) between white noise produced by audiotestsrc and the same data after it has been downsampled from 16 kHz to 2 kHz and then upsampled back to 16 kHz. The magnitude plot shows that the signal is significantly attenuated below the Nyquist frequency of 1 kHz. (So perhaps I should clarify that the systematic errors I observed were not likely due to aliasing, but rather to this extra attenuation.) Is this attenuation intentional, and if so, is there a setting that will not attenuate the signal much below the Nyquist rate?
Comment 4 Sebastian Dröge (slomo) 2018-03-20 19:22:45 UTC
I would have to check in more detail, but isn't this what https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstAudio.html#GST-AUDIO-RESAMPLER-OPT-CUTOFF:CAPS is configuring?
Comment 5 Aaron Viets 2018-03-20 21:22:40 UTC
I assumed that
<https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstAudio.html#GST-AUDIO-RESAMPLER-OPT-CUTOFF:CAPS>
is defining the cutoff frequency to be 0.94 times the Nyquist frequency. Is this correct? My question is why the signal is attenuated far below this, even at the DC component. From DC to a little under the Nyquist frequency in the plot I attached, the attenuation factor is between about 0.6 and 0.9. Is this the intended behavior, and is there a way to avoid this attenuation?
Comment 6 Sebastian Dröge (slomo) 2018-03-21 06:40:37 UTC
CC'ing Wim as he wrote the resampler. He probably knows best :)
Comment 7 Aaron Viets 2018-03-27 13:18:24 UTC
Created attachment 370187 [details]
audioresample transfer function

After experimenting with different properties, I found that using quality = 9 and resample_method = 4 (kaiser) came closer to the desired behavior. However, there was a phase error in the passband, as shown in the attached plots. I've attached similar plots of transfer functions (see comment 3). I've also included plots zoomed in on the passband to show the phase error. For comparison, I've attached the same two transfer function plots produced from data that was resampled by another resampling element that we use. Perhaps there is a timestamp bug?
Comment 8 Aaron Viets 2018-03-27 13:19:01 UTC
Created attachment 370188 [details]
audioresample transfer function zoomed
Comment 9 Aaron Viets 2018-03-27 13:20:07 UTC
Created attachment 370189 [details]
lal_resample transfer function
Comment 10 Aaron Viets 2018-03-27 13:20:35 UTC
Created attachment 370190 [details]
lal_resample transfer function zoomed
Comment 11 Aaron Viets 2018-03-27 13:32:16 UTC
Created attachment 370191 [details]
audioresample transfer function zoomed only downsample

To see whether the phase error comes from upsampling or downsampling, I did a similar test to the one above, but using audioresample for only downsampling, and then using it for only upsampling. Plots are attached.
Comment 12 Aaron Viets 2018-03-27 13:34:36 UTC
Created attachment 370192 [details]
audioresample transfer function zoomed only upsample

It appears that there is a phase error associated with both upsampling and downsampling, but the error is greater when upsampling. I am still using the same basic pipeline that generates white noise at 16384 Hz, downsamples it to 2048 Hz, and then upsamples it again to 16384 Hz.
Comment 13 Sebastian Dröge (slomo) 2018-04-30 07:53:12 UTC
<slomo> wtay: https://bugzilla.gnome.org/show_bug.cgi?id=794411 do you have any ideas about this one? :)
<slomo> wtay: audio resampler aliasing
<wtay> slomo, no idea, I tuned the quality param to give exactly the same values as what speex did
<wtay> other than that.. would need to compare the calculated filter against speex to see if it lines up
Comment 14 GStreamer system administrator 2018-11-03 12:04:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/426.