You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #110, support was added to bypass the NeuQuant algorithm when the color count was <= 256 so that it could fit in a palette without quantization. The implementation is very straightforward and clear but there may be possible performance improvements. It'd be good to have a benchmark to test changes in this function since it's in the main path for encoding Frames.
The following are preliminary thoughts on the topic. They may not be faster than the current implementation.
At the cost of making the logic more complex, there may be a way to reduce allocation and hash calculations in palette creation. A HashSet is used, collected into a Vec, and then the Vec is built into a HashMap. The HashMap and palette indexing could be built from the start but manual bookkeeping would need to be introduced for indexing.
I've been working on a personal project using gif, and wanted to bench a different algo I implemented amongst other things, so I'm currently working on this. I can guarantee the quality of my code as I'm fairly new to rust, but I'll be happy to contribute if it's deemed up to par.
In #110, support was added to bypass the NeuQuant algorithm when the color count was
<= 256
so that it could fit in a palette without quantization. The implementation is very straightforward and clear but there may be possible performance improvements. It'd be good to have a benchmark to test changes in this function since it's in the main path for encodingFrame
s.The following are preliminary thoughts on the topic. They may not be faster than the current implementation.
At the cost of making the logic more complex, there may be a way to reduce allocation and hash calculations in palette creation. A
HashSet
is used, collected into aVec
, and then theVec
is built into aHashMap
. TheHashMap
and palette indexing could be built from the start but manual bookkeeping would need to be introduced for indexing.image-gif/src/common.rs
Lines 220 to 255 in 5410cb3
It's not clear if this
sort
is necessary. Maybe it can be made into asort_unstable
or removed altogether.image-gif/src/common.rs
Lines 239 to 243 in 5410cb3
Original discussion started in #111 (comment)
The text was updated successfully, but these errors were encountered: