[gstreamer-bugs] [Bug 360246] [audioconvert] Optionally apply dithering

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Sat Apr 14 15:06:32 PDT 2007

If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:

  GStreamer | gst-plugins-base | Ver: HEAD CVS

------- Comment #11 from David Schleef  2007-04-14 22:06 UTC -------
git clone git://people.freedesktop.org/~ds/cog

in cog/gst/gstdither.c.

The code in gstdither.c quantizes int16_t audio into values that can be
directly shifted into int8_t.  I.e., the low 8 bits of each output sample is 0.
 I tried integrating this code into audioconvert.c and got frustrated -- I'd
want to rewrite audioconvert.c into four stages: unpack, mix, quantize, pack,
with better control over intermediate buffers.

Since audioconvert uses int32_t as the unpacked format, the code needs to be
adjusted to check for overflows and/or use int64_t as intermediates.  Another
possibility is to shift the 32 bit values right by 8 bits (thus losing 8 LSBs)
before quantizing -- converting 32->24 doesn't need dithering anyway.

There's also code for converting float to int16_t, but it creates the float
samples by converting from int16_t.

The random number generator (for dithering) is from liboil.  Liboil has good
random number generation, but it's used very poorly here.  Ideally,
audioconvert should have a random number generator context that it uses only to
generate dithering, and reset it when other element state gets reset
(READY->PAUSED).  Liboil doesn't have contextual RNG, whereas glib does.  So
I'd recommend using glib's RNG until liboil is fixed.

See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=360246.

More information about the Gstreamer-bugs mailing list