mpd/src/pcm
Max Kellermann af99f9fc90 pcm/Volume: convert S16 to S24 to preserve quality and reduce noise
Applying software volume to S16 samples means several bits of
precision are lost; at 25% volume, two bits are lost.  Additionally,
dithering adds some noise.

The problem gets worse when you apply the software volume code twice:
for the software mixer volume, and again for the replay gain.  This
loses some more precision and adds even more dithering noise, which
can become audible (see
https://github.com/MusicPlayerDaemon/MPD/issues/542).

By converting everything to 24 bit, we need to shift only two bits to
the right instead of ten, losing nearly no precision, and dithering is
not needed.  Even if the output device is unable to play S24 directly,
we can convert back to S16 with only one stage of dithering.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/542
2019-07-30 20:03:37 +02:00
..
dsd2pcm include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Buffer.cxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Buffer.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
ChannelDefs.hxx AudioFormat: move MAX_CHANNELS to pcm/ChannelDefs.hxx 2019-06-17 22:11:08 +02:00
ChannelsConverter.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
ChannelsConverter.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Clamp.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
ConfiguredResampler.cxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
ConfiguredResampler.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Convert.cxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Convert.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Dither.cxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Dither.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Dop.cxx pcm/Dop: stash odd frames away for the next call 2019-06-17 22:18:44 +02:00
Dop.hxx pcm/Export: add GetInputBlockSize(), GetOutputBlockSize() 2019-06-26 15:49:08 +02:00
Dsd16.cxx pcm/Dsd{16,32}: stash odd frames away for the next call 2019-06-18 11:19:27 +02:00
Dsd16.hxx pcm/Export: add GetInputBlockSize(), GetOutputBlockSize() 2019-06-26 15:49:08 +02:00
Dsd32.cxx pcm/Dsd{16,32}: stash odd frames away for the next call 2019-06-18 11:19:27 +02:00
Dsd32.hxx pcm/Export: add GetInputBlockSize(), GetOutputBlockSize() 2019-06-26 15:49:08 +02:00
Export.cxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Export.hxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
FallbackResampler.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
FallbackResampler.hxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
FloatConvert.hxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
FormatConverter.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
FormatConverter.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
GlueResampler.cxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
GlueResampler.hxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Interleave.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Interleave.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
LibsamplerateResampler.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
LibsamplerateResampler.hxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
meson.build pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Mix.cxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Mix.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Neon.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Order.cxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Order.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Pack.cxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Pack.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
PcmChannels.cxx AudioFormat: move MAX_CHANNELS to pcm/ChannelDefs.hxx 2019-06-17 22:11:08 +02:00
PcmChannels.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
PcmDsd.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
PcmDsd.hxx AudioFormat: move MAX_CHANNELS to pcm/ChannelDefs.hxx 2019-06-17 22:11:08 +02:00
PcmFormat.cxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
PcmFormat.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Prng.hxx pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Resampler.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
RestBuffer.hxx pcm/Export: add GetInputBlockSize(), GetOutputBlockSize() 2019-06-26 15:49:08 +02:00
SampleFormat.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
SampleFormat.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
ShiftConvert.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Silence.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Silence.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
SoxrResampler.cxx Copyright year 2019 2019-06-17 11:17:30 +02:00
SoxrResampler.hxx include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Traits.hxx Copyright year 2019 2019-06-17 11:17:30 +02:00
Volume.cxx pcm/Volume: convert S16 to S24 to preserve quality and reduce noise 2019-07-30 20:03:37 +02:00
Volume.hxx pcm/Volume: convert S16 to S24 to preserve quality and reduce noise 2019-07-30 20:03:37 +02:00