audioconvert: fix dither scale

Rectangular dither should be [-0.5, 0.5]
Triangular dither should be [-1.0, 1.0]
Noise should add extra bits.
This commit is contained in:
Wim Taymans 2022-07-11 17:19:28 +02:00
parent e313149f7f
commit 68f883ff77
4 changed files with 23 additions and 3 deletions

View file

@ -237,6 +237,7 @@ static inline void update_dither_c(struct convert *conv, uint32_t n_samples)
uint32_t *state = &conv->random[0];
if (conv->method < DITHER_METHOD_TRIANGULAR) {
scale *= 0.5f;
for (n = 0; n < n_samples; n++)
dither[n] = lcnoise(state) * scale;
} else {