Skip to content

Commit d4f466e

Browse files
committed
Revert math::round_half_to_even
This caused quite a bump in CPU usage, which be acceptable if this actually improved sound quality. However, it turns out that this function only has one decimal precision, i.e. it would consider all values from `0.50..0.60` (exclusive) as `0.5` which is in error for our purposes.
1 parent ad19b69 commit d4f466e

3 files changed

Lines changed: 13 additions & 78 deletions

File tree

Cargo.lock

Lines changed: 11 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

playback/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ version = "0.2.0"
2020
[dependencies]
2121
futures-executor = "0.3"
2222
futures-util = { version = "0.3", default_features = false, features = ["alloc"] }
23-
libmath = "0.2"
2423
log = "0.4"
2524
byteorder = "1.4"
2625
shell-words = "1.0.0"
@@ -59,4 +58,4 @@ jackaudio-backend = ["jack"]
5958
rodio-backend = ["rodio", "cpal", "thiserror"]
6059
rodiojack-backend = ["rodio", "cpal/jack", "thiserror"]
6160
sdl-backend = ["sdl2"]
62-
gstreamer-backend = ["gstreamer", "gstreamer-app", "glib"]
61+
gstreamer-backend = ["gstreamer", "gstreamer-app", "glib"]

playback/src/convert.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ impl Converter {
6363

6464
// Casting float to integer rounds towards zero by default, i.e. it
6565
// truncates, and that generates larger error than rounding to nearest.
66-
// Absolute lowest error is gained from rounding ties to even.
67-
math::round::half_to_even(int_value, 0)
66+
int_value.round()
6867
}
6968

7069
// Special case for samples packed in a word of greater bit depth (e.g.

0 commit comments

Comments
 (0)