-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some easy optimizations are available #46
Comments
@steven-joruk raises good points indeed and his encoding implementation is on average around 5-10% faster (than However it's possible to make encoding 40-50% faster on kodak and 3-4x faster on screenshots (on screenshots in particular, this starts beating libpng by some absolutely obscure amounts), and I think it's not the end, it could probably be squeezed even further. I've been also working on a Rust implementation lately ( I've had the benchmark suite comparing QOI implementations (compiling and linking C library directly into Rust so as to exclude any i/o etc), and I've added @steven-joruk's one temporarily to get some numbers, see below. Benchmarks from
Benchmarks from
|
Update, decoders can also be sped up 2x 😄
|
With these modifications would little endian still be advantageous? #36 |
Yes, it's completely orthogonal. |
Another rust implementation https://github.com/JohnPeel/qoi |
Also here. |
I found a minor compression improvement for the current implementation (fda5167). My Rust implementation does this. |
@taotao54321 can you check how often this occurs? |
I quickly checked using Kodak image suite. Converting all 24 files with the current So the difference is 4605 Bytes. The difference between QOI_DIFF_24 and single-entry QOI_COLOR is 1 Byte, so the occurrence will be also 4605 times. |
It seems like we should be able to do something with the tag that's better than a |
Hey, I'm too work on Rust QOI implementation. I've rewrote benchmark in Rust too and included my crate Lines starting from
Interestingly. Original diffs intervals were moved lately and broke one of my encoding optimizations.
|
@aldanor any update? |
@darleybarreto Yes, I'm in the process of cleaning it up and updating the benchmarks (as it's been run on half of the suite only), was planning to post it here as soon as it's done (and adding a PR in this repo to mention it in the readme). This will also be renamed to just |
Added https://github.com/aldanor/qoi-rust to the list of implementations in #164. |
Hey, thanks for the work you're putting in to this.
I've written a Rust implementation of your image format (https://github.com/steven-joruk/qoi) and added some optimizations you might want to take as well.
The biggest gain is by factoring out writing the QOI_RUN command which lets you get rid of a bunch of redundant comparisons and a couple of branches: steven-joruk/qoi@3f3ee0a
You can reduce some more branches when writing QOI_COLOUR: https://github.com/steven-joruk/qoi/blob/3f3ee0ae7ecbb62a4b293f932d28580099989159/src/encode.rs#L158
And I'm unsure if this has an real affect but you only need to store the previous colour when it's changed (move the assignment in to the
px_prev != px
block).When I hacked those in to my local qoi.h I saw improvements of around 16% for dice.png, I haven't measured other files. The rust benchmark encodes dice.qoi (from raw) in around 2.3ms compared to qoibench's 3.7ms (3.4ms with the above changes), I haven't compared the assembly or profiles to see what else may be going on.
The text was updated successfully, but these errors were encountered: