Merge pull request #785 from roderickvd/revert-round-half-to-even

Revert `math::round_half_to_even`
This commit is contained in:
Roderick van Domburg 2021-06-01 08:17:28 +02:00 committed by GitHub
commit 33c07f0e2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 78 deletions

85
Cargo.lock generated
View file

@ -435,12 +435,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.15" version = "0.3.15"
@ -1079,15 +1073,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "libmath"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfd3416934a853ae80d5c3b006f632dfcbaf320300c5167e88a469e9ac214502"
dependencies = [
"rand 0.3.23",
]
[[package]] [[package]]
name = "libmdns" name = "libmdns"
version = "0.6.1" version = "0.6.1"
@ -1100,7 +1085,7 @@ dependencies = [
"if-addrs", "if-addrs",
"log", "log",
"multimap", "multimap",
"rand 0.8.3", "rand",
"socket2", "socket2",
"thiserror", "thiserror",
"tokio", "tokio",
@ -1205,7 +1190,7 @@ dependencies = [
"librespot-protocol", "librespot-protocol",
"log", "log",
"protobuf", "protobuf",
"rand 0.8.3", "rand",
"serde", "serde",
"serde_json", "serde_json",
"tokio", "tokio",
@ -1238,7 +1223,7 @@ dependencies = [
"pbkdf2", "pbkdf2",
"priority-queue", "priority-queue",
"protobuf", "protobuf",
"rand 0.8.3", "rand",
"serde", "serde",
"serde_json", "serde_json",
"sha-1", "sha-1",
@ -1269,7 +1254,7 @@ dependencies = [
"libmdns", "libmdns",
"librespot-core", "librespot-core",
"log", "log",
"rand 0.8.3", "rand",
"serde_json", "serde_json",
"sha-1", "sha-1",
"simple_logger", "simple_logger",
@ -1303,7 +1288,6 @@ dependencies = [
"gstreamer-app", "gstreamer-app",
"jack 0.7.1", "jack 0.7.1",
"lewton", "lewton",
"libmath",
"libpulse-binding", "libpulse-binding",
"libpulse-simple-binding", "libpulse-simple-binding",
"librespot-audio", "librespot-audio",
@ -1312,7 +1296,7 @@ dependencies = [
"log", "log",
"ogg", "ogg",
"portaudio-rs", "portaudio-rs",
"rand 0.8.3", "rand",
"rand_distr", "rand_distr",
"rodio", "rodio",
"sdl2", "sdl2",
@ -1504,7 +1488,7 @@ dependencies = [
"autocfg", "autocfg",
"num-integer", "num-integer",
"num-traits", "num-traits",
"rand 0.8.3", "rand",
] ]
[[package]] [[package]]
@ -1856,29 +1840,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rand"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
dependencies = [
"libc",
"rand 0.4.6",
]
[[package]]
name = "rand"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
dependencies = [
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"rdrand",
"winapi",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.8.3" version = "0.8.3"
@ -1887,7 +1848,7 @@ checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha",
"rand_core 0.6.2", "rand_core",
"rand_hc", "rand_hc",
] ]
@ -1898,24 +1859,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core 0.6.2", "rand_core",
] ]
[[package]]
name = "rand_core"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
dependencies = [
"rand_core 0.4.2",
]
[[package]]
name = "rand_core"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.6.2" version = "0.6.2"
@ -1932,7 +1878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9e8f32ad24fb80d07d2323a9a2ce8b30d68a62b8cb4df88119ff49a698f038" checksum = "da9e8f32ad24fb80d07d2323a9a2ce8b30d68a62b8cb4df88119ff49a698f038"
dependencies = [ dependencies = [
"num-traits", "num-traits",
"rand 0.8.3", "rand",
] ]
[[package]] [[package]]
@ -1941,16 +1887,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [ dependencies = [
"rand_core 0.6.2", "rand_core",
]
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
dependencies = [
"rand_core 0.3.1",
] ]
[[package]] [[package]]
@ -2275,7 +2212,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"rand 0.8.3", "rand",
"redox_syscall", "redox_syscall",
"remove_dir_all", "remove_dir_all",
"winapi", "winapi",

View file

@ -20,7 +20,6 @@ version = "0.2.0"
[dependencies] [dependencies]
futures-executor = "0.3" futures-executor = "0.3"
futures-util = { version = "0.3", default_features = false, features = ["alloc"] } futures-util = { version = "0.3", default_features = false, features = ["alloc"] }
libmath = "0.2"
log = "0.4" log = "0.4"
byteorder = "1.4" byteorder = "1.4"
shell-words = "1.0.0" shell-words = "1.0.0"

View file

@ -63,8 +63,7 @@ impl Converter {
// Casting float to integer rounds towards zero by default, i.e. it // Casting float to integer rounds towards zero by default, i.e. it
// truncates, and that generates larger error than rounding to nearest. // truncates, and that generates larger error than rounding to nearest.
// Absolute lowest error is gained from rounding ties to even. int_value.round()
math::round::half_to_even(int_value, 0)
} }
// Special case for samples packed in a word of greater bit depth (e.g. // Special case for samples packed in a word of greater bit depth (e.g.