Support and General Use > Audio Playback, Database and Playlists

Dithering & noise shaping - When/where/how?

(1/3) > >>

mlind:
CVS log 27 Oct 20:41 by Thom Johansen:

--- Quote ---Re-enable the currently unused and broken dithering and noise shaping code already in Rockbox.
...
...feedback is welcome.
--- End quote ---

Is this used only for playback of files needing resampling, or what?

Where should I expect to notice differences?

(yes, I know what it does generally)

bk:
From my quick scanning of the code it looks like dithering from 24/32 bit samples down to the 16 bits supported by the hardware. I don't know what noise shaping refers to.

perfectdrug:
there was discussion and explanation about this yesterday (?) in IRC
you may look there for additional info

preglow:
Dithering has nothing to do with resampling, it has to do with converting from one bit depth to another. Most of our lossy codecs decode to a bit depth that's significantly higher than the 16 bits that are used for output. For example, MP3 is decoded to 29 bits and Ogg Vorbis to 25 bits. When converting this to 16 bits for output, one can just throw away the lower bits, which is default behaviour, or dither. Just throwing away the samples will yield quantisation noise, which is perceived as distortion that changes character with the sound, and can be quite annoying. With dithering enabled, this noise will take the form of uniform background noise, comparable to noise heard in good old-fashioned analogue recordings. Most people will find this noise much more comfortable.

Noise shaping is just shaping the dithering noise to the parts of the spectrum where humans can not hear it so easily. Rockbox uses a simple third order noise shaper which pushes some of the noise up to above 10kHz.
I have prepared a simple but exaggerated example of how this works. The example works with 8 bit output quality, but the principle is the same with 16 bits, just way less pronounced. The file is at:
http://www.pvv.org/~thomj/rockbox/8bitdither.flac
The first segment is default behaviour, the second segment is dithering/noise shaping, and the last is just dithering.

Now, how necessary it is to apply dithering to 16 bit signals is debatable. I myself have no chance in hell to hear the difference. I did a small test, and concluded that I could hear the difference at 13 bits, but no more. However, my hearing probably isn't the finest seen this side of the moon either, so I thought I'd commit to see what people think. I'd be more than happy to remove the entire option and reclaim the code space taken.

BTW: Applying dithering for lossless codecs don't necessarily make sense unless the files have more bits per sample than 16. However, the moment you apply any effects like crossfeed and EQ, dithering will make sense even for files at 16 bits, since these effects operate at a higher precision.

ryran:
Whoa. Thanks for the uber-detailed explanation Thom.

Navigation

[0] Message Index

[#] Next page

Go to full version