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 338718 - [patch] [audioconvert] correctly clip float samples > 1.0
[patch] [audioconvert] correctly clip float samples > 1.0
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.5
Other All
: Normal normal
: 0.10.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 340798 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-16 17:12 UTC by Ingo Planz
Modified: 2006-05-06 08:46 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
Screenshot of the two waves (5.21 KB, image/png)
2006-04-18 19:41 UTC, Ingo Planz
  Details
Simple fix for audioconvert (513 bytes, patch)
2006-04-19 15:26 UTC, Lauri Mylläri
rejected Details | Review
increase precision in float to int conversion (761 bytes, patch)
2006-04-24 08:55 UTC, Wim Taymans
committed Details | Review

Description Ingo Planz 2006-04-16 17:12:00 UTC
Please describe the problem:
With some ogg/vorbis-files the vorbisdec creates float samples that are slightly
bigger than 1.0000. This particularly causes audioconvert to wrongly convert to
integer samples, resulting in a very annoying noise.

Steps to reproduce:
gst-launch-0.10 audiotestsrc volume=1.0 ! audioconvert ! vorbisenc ! vorbisdec !
audioconvert ! alsasink



Actual results:
There is a loud noise.

Expected results:
There should be a loud 440Hz sine tone.

Does this happen every time?
Yes.

Other information:
Happens on both my Pentium M and AMD Athlon (32bit) computers.
Comment 1 Wim Taymans 2006-04-18 10:26:56 UTC
audioconvert seems to clip correctly, are you sure the noise is not caused by the clipping?

As for vorbisdec creating samples outside of the range, this is entirely possible as vorbis does not deal very well with input that is extending the full input range. 
Comment 2 Ingo Planz 2006-04-18 19:39:14 UTC
(In reply to comment #1)
> audioconvert seems to clip correctly, are you sure the noise is not caused by
> the clipping?
> 

I now tried the following two pipelines (440.ogg is the sine wave):

gst-launch-0.10 filesrc location=440.ogg ! oggdemux ! vorbisdec ! filesink location="440-float.raw"

gst-launch-0.10 filesrc location=440.ogg ! oggdemux ! vorbisdec ! audioconvert ! audio/x-raw-int ! filesink location="440-int.raw"

and got the attached (audacity) screenshot. The upper wave is the float and the bottom one is the integer one. It seems that someone turns everything bigger than 1.000 into -1.000.

By the way, gstreamer-0.8 seems to work fine.
Comment 3 Ingo Planz 2006-04-18 19:41:12 UTC
Created attachment 63820 [details]
Screenshot of the two waves
Comment 4 Lauri Mylläri 2006-04-19 15:23:02 UTC
audioconvert didn't clip correctly for me either. Attaching a patch that fixes it.
Comment 5 Lauri Mylläri 2006-04-19 15:26:16 UTC
Created attachment 63877 [details] [review]
Simple fix for audioconvert
Comment 6 Wim Taymans 2006-04-24 08:54:02 UTC
strange, still nothing wrong on my machine, maybe something specific to the compiler or so. does attached patch work as well, it's more closely to the reference vorbis float to int code.
Comment 7 Wim Taymans 2006-04-24 08:55:07 UTC
Created attachment 64180 [details] [review]
increase precision in float to int conversion
Comment 8 Lauri Mylläri 2006-04-24 10:00:59 UTC
Using "gcc version 3.3.5 (Debian 1:3.3.5-13)" and your patch also fixes this for me.
Comment 9 Wim Taymans 2006-04-24 10:09:56 UTC
ok, thank you for verifying.
Comment 10 Wim Taymans 2006-04-28 14:13:52 UTC
        * gst/audioconvert/audioconvert.c: (float):
        correctly clip float samples > 1.0. Fixes #338718
Comment 11 Tim-Philipp Müller 2006-05-06 08:46:49 UTC
*** Bug 340798 has been marked as a duplicate of this bug. ***