From afcf0795c44260f54e74ec854297de439e7562c3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 22 Dec 2013 17:39:26 +0100 Subject: pcm/Volume: improved dithering Instead of just adding a rectangular random value before shifting back to the normal scale, use the existing PcmDither library. --- test/test_pcm_volume.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/test_pcm_volume.cxx') diff --git a/test/test_pcm_volume.cxx b/test/test_pcm_volume.cxx index bba5d3bbf..c3a261f7a 100644 --- a/test/test_pcm_volume.cxx +++ b/test/test_pcm_volume.cxx @@ -60,8 +60,9 @@ TestVolume(G g=G()) const auto _dest = ConstBuffer::FromVoid(dest); for (unsigned i = 0; i < N; ++i) { - CPPUNIT_ASSERT(_dest.data[i] >= (_src[i] - 1) / 2); - CPPUNIT_ASSERT(_dest.data[i] <= _src[i] / 2 + 1); + const auto expected = (_src[i] + 1) / 2; + CPPUNIT_ASSERT(_dest.data[i] >= expected - 4); + CPPUNIT_ASSERT(_dest.data[i] <= expected + 4); } pv.Close(); -- cgit v1.2.3