Commit 108d9f79 authored by Mark Hills's avatar Mark Hills
Browse files

Use of the wrong type causes the dither to converge

Thanks to Stefan Berg-Johansen for a high quality bug report.

> The type declaration on line 79 in`player.c` should read `static
> unsigned short x = 0xbabe;`. In the current master branch, `x` is a
> static _signed_ short, which results in it taking on negative values
> outside of the intended range. Another side effect is that the
> returned sequence happens to converge after about 15 calls to a
> small negative number, so effectively the current dither function
> only imposes a small constant offset and nothing else.
parent de5e2106
* Fix a bug that prevented dithering from being used
v1.6 (2016-08-13)
......@@ -75,8 +75,8 @@ static inline double cubic_interpolate(signed short y[4], double mu)
double dither(void)
short bit;
static short x = 0xbabe;
unsigned short bit;
static unsigned short x = 0xbabe;
/* Use a 16-bit maximal-length LFSR as our random number.
* This is faster than rand() */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment