1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00

feat: improve Gaussian dither

This commit is contained in:
Roderick van Domburg 2025-08-13 18:40:00 +02:00
parent fe7ca0d700
commit 416bf00888
No known key found for this signature in database
GPG key ID: 607FA06CB5236AE0

View file

@ -82,8 +82,15 @@ impl Ditherer for GaussianDitherer {
fn new() -> Self {
Self {
cached_rng: create_rng(),
// 1/2 LSB RMS needed to linearize the response:
distribution: Normal::new(0.0, 0.5).unwrap(),
// For Gaussian to achieve equivalent decorrelation to triangular dithering, it needs
// 3-4 dB higher amplitude than TPDF's optimal 0.408 LSB. If optimizing:
// - minimum correlation: σ ≈ 0.58
// - perceptual equivalence: σ ≈ 0.65
// - worst-case performance: σ ≈ 0.70
//
// σ = 0.6 LSB is a reasonable compromise that balances mathematical theory with
// empirical performance across various signal types.
distribution: Normal::new(0.0, 0.6).unwrap(),
}
}