diff options
author | Max Kellermann <max@duempel.org> | 2013-12-22 17:39:26 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-28 18:30:24 +0100 |
commit | afcf0795c44260f54e74ec854297de439e7562c3 (patch) | |
tree | f4ec95c5d889d81ec840f83f105a03625f663cb6 /src/pcm/PcmDither.hxx | |
parent | 394e2815dbaf0edb8d0f34b6ceab96b58f071ea8 (diff) | |
download | mpd-afcf0795c44260f54e74ec854297de439e7562c3.tar.gz mpd-afcf0795c44260f54e74ec854297de439e7562c3.tar.xz mpd-afcf0795c44260f54e74ec854297de439e7562c3.zip |
pcm/Volume: improved dithering
Instead of just adding a rectangular random value before shifting back
to the normal scale, use the existing PcmDither library.
Diffstat (limited to 'src/pcm/PcmDither.hxx')
-rw-r--r-- | src/pcm/PcmDither.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pcm/PcmDither.hxx b/src/pcm/PcmDither.hxx index fdcdb1f6a..473a45ac3 100644 --- a/src/pcm/PcmDither.hxx +++ b/src/pcm/PcmDither.hxx @@ -32,6 +32,18 @@ public: constexpr PcmDither() :error{0, 0, 0}, random(0) {} + /** + * Shift the given sample by #SBITS-#DBITS to the right, and + * apply dithering. + * + * @param ST the input sample type + * @param SBITS the input bit width + * @param DBITS the output bit width + * @param sample the input sample value + */ + template<typename ST, unsigned SBITS, unsigned DBITS> + ST DitherShift(ST sample); + void Dither24To16(int16_t *dest, const int32_t *src, const int32_t *src_end); |