pcmconv: revert previous change, fix dither clipping

previous change had forgot how dithering works... m(

we *really* add a random signal when *reducing* the number
of bits. just make sure we do not overflow like in
mixin().
This commit is contained in:
cinap_lenrek 2014-03-03 14:45:14 +01:00
parent 7fc7802358
commit f7ab9fb52a

View file

@ -209,12 +209,13 @@ dither(int *y, int ibits, int obits, int count)
{
static ulong prnd;
if(ibits >= 32 || ibits >= obits)
if(ibits >= 32 || obits >= ibits)
return;
while(count--){
prnd = (prnd*0x19660dL + 0x3c6ef35fL) & 0xffffffffL;
*y++ += ((int)prnd) >> ibits;
*y = clip((vlong)*y + ((int)prnd >> ibits));
y++;
}
}