Sergey "Shnatsel" Davidoff
Sergey "Shnatsel" Davidoff
Yep, no regressions as far as I can tell :+1: I'll run some additional tests and file bugs if I find any issues.
PNG was created in the 90s for network use cases specifically. Back then networks were less reliable and could flip bits at random far more frequently than they do now....
This sample aside, I am astonished how few divergences from other decoders I have found. The entirety of my imageboard dataset (10,000 images, jpeg/gif/png) and a chunk of the wallhaven...
`emulsion` also displays the image as blank, so I think the saving step can be ruled out. It's the loading step that's the culprit.
I've taken an experimental stab at this. It seems we'll still need crossbeam-utils for [scoped threads](https://docs.rs/crossbeam-utils/0.8.0/crossbeam_utils/thread/fn.scope.html), but we could still get rid of `crossbeam-deque` and `rayon` dependencies which are ~500...
Which might be a very good thing, since `crossbeam-deque` is pulling some dubiously legal tricks: https://github.com/rayon-rs/rayon/issues/812 and all major _single-threaded_ deque implementations in Rust had [serious](https://rustsec.org/advisories/CVE-2018-1000657.html) [memory](https://rustsec.org/advisories/RUSTSEC-2018-0008.html) [bugs](https://rustsec.org/advisories/RUSTSEC-2019-0002.html), and `crossbeam-deque`...
My initial implementation - full of `unwrap()`, but probably functional - can be found here: https://github.com/Shnatsel/jpeg-decoder/tree/rayonless So far it's decoding https://commons.wikimedia.org/wiki/File:Sun_over_Lake_Hawea,_New_Zealand.jpg in 332ms as opposed to 308ms with Rayon, but...
The addition of some naive batching has put the custom impl in line with Rayon, and even made it faster by a tiny bit - 305ms vs 308ms with Rayon....
I've tried adding some heuristics for batching and choosing the number of CPUs, but so far all it did was regress my benchmarks across the board
`tiny-skia` (port of a subset of Skia to Rust) also needs this: https://github.com/RazrFalcon/tiny-skia/blob/master/benches/README.md#png