mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
audioconvert: add triangular dither
This commit is contained in:
parent
9a5a71dda9
commit
277addcca6
2 changed files with 20 additions and 3 deletions
|
|
@ -236,8 +236,13 @@ static inline void update_dither_c(struct convert *conv, uint32_t n_samples)
|
|||
float *dither = conv->dither, scale = conv->scale;
|
||||
uint32_t *state = &conv->random[0];
|
||||
|
||||
for (n = 0; n < n_samples; n++)
|
||||
dither[n] = lcnoise(state) * scale;
|
||||
if (conv->method < DITHER_METHOD_TRIANGULAR) {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
dither[n] = lcnoise(state) * scale;
|
||||
} else {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
dither[n] = (lcnoise(state) + lcnoise(state)) * scale;
|
||||
}
|
||||
}
|
||||
|
||||
#define MAKE_D_dither(dname,dtype,func) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue