From: Mike Brady Date: Thu, 8 Sep 2016 06:57:28 +0000 (+0100) Subject: Get dither mask working right X-Git-Tag: 3.0.d18~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fad92e7a7b2d2c4a232f5f00f0aa9beb87eaf2f;p=thirdparty%2Fshairport-sync.git Get dither mask working right --- diff --git a/player.c b/player.c index a47b985c..5990c45d 100644 --- a/player.c +++ b/player.c @@ -593,10 +593,10 @@ static inline int32_t dithered_vol_32(int32_t sample, int output_precision) { s = s*v; // 32 bit multiplication -- we need to dither it down to its target resolution int64_t r = r64i(); - int64_t mask = 1<<(64+1-output_precision); - //mask -=1; + int64_t mask = (int64_t)1<<(64+1-output_precision); + mask -=1; int64_t tpdf = (r&mask); //-(previous_random_number&((1<<(64+1-output_precision))-1)); - debug(1,"output precision is %d, m is %llx, r is %llx, tpdf is %llx",output_precision,mask,r,tpdf); +// debug(1,"output precision is %d, m is %llx, r is %llx, tpdf is %llx",output_precision,mask,r,tpdf); previous_random_number=r; // Check there's no clipping -- if there is,