Closed est31 closed 7 years ago
Out of similar reasons as to why I didn't use the ogg crate, I didn't do a PR for the gif crate yet.
This looks good to me, but I'd like sign-off from a Vorbis expert.
@metajack Do you have thoughts on lewton?
A few points about lewton:
nightly-2016-10-19
, it is about 20% slower than libvorbis for floor 1, but for floor 0 its faster (not that floor 0 is relevant, but hey, its faster xD). Performance in both scenarios should be fast enough for all purposes.dev/cmp
directory and running cargo run --release vals <file name here>
to compare the output or cargo run --release perf <file name here>
to compare the speed with libvorbis. cargo test --release
and cargo run --release bench
will run benchmarks and value comparisons for a set of test files.This looks a lot simpler, and I'm a big fan of the removal of most unsafe code. We should make sure we are opting into the ieee754 feature when used.
Also, we should probably have some unit tests that decode simple files just as a sanity check.
I'd love to see benchmarks of this vs. libvorbis so we know what optimization work needs to be done down the road.
@metajack when I run the benchmark tool I described in the post above, I get (these files are automatically downloaded from fairly stable locations):
Comparing speed for bwv_1043_vivace.ogg : libvorbis=0.8301s we=1.0253s difference=1.24x
Comparing speed for bwv_543_fuge.ogg : libvorbis=1.3267s we=1.6383s difference=1.23x
Comparing speed for maple_leaf_rag.ogg : libvorbis=0.3890s we=0.4762s difference=1.22x
Comparing speed for hoelle_rache.ogg : libvorbis=0.6277s we=0.7707s difference=1.23x
Comparing speed for thingy-floor0.ogg : libvorbis=0.3503s we=0.2717s difference=0.78x
Overall time spent for decoding by libvorbis: 3.5238s
Overall time spent for decoding by us: 4.1823s
Overall ratio of difference: 1.19x
@metajack I've enabled the ieee754 feature as requested.
About the sanity test unit tests: Where do you want them, here or in the lewton repo, because there are already such test files inside the lewton repo (you cd into dev/cmp then run cargo test --release
)?
I think here is a good place for the tests.
I'm totally fine with 20% perf regression in exchange for safety. We can optimize lewton if needed.
I would like some sanity tests here, but they can be cursory since lewton is already also testing. Mostly I want to protect against the error case where rust-media still builds but doesn't actual work; that situation is common on Servo for android where we don't have any smoke tests.
Added an unit test. I couldn't use the ogg container decoder from rust-media as it isn't exposed via the high level API yet.
Awesome, thanks!
I didn't exchange libogg with the ogg crate yet because of API restrictions. I need to come up with a better concept for this upstream.