JuliaIO / GIFImages.jl

Provides Gif support in Julia using LibGif
https://ashwani-rathee.github.io/GIFImages.jl/dev/
MIT License
12 stars 2 forks source link

Encode Operation #6

Closed ashwani-rathee closed 2 years ago

ashwani-rathee commented 2 years ago

This intends to solve the encoding operation for the gif file in Julia


After first commit, it's no good for us

julia> @btime gif_encode("test1.gif", img) # from gifimages
  23.328 ms (181010 allocations: 8.33 MiB)

julia> @btime save("test.gif", img) # from imagemagick
  9.790 ms (52 allocations: 524.83 KiB)

Quantization, Unique functions are slow, might need to write quantization algorithm that return quantized image and colormap used. or something useful can be found in ImageSegmentation.jl. Makes sense to use staticarrays.

Some improvements in allocations after 2, use of inplace methods and removal of redundant functions helps :

julia> @btime gif_encode("test1.gif", img)
  17.782 ms (3218 allocations: 343.05 KiB)

But quantization and unique alone contribute 11 ms to gif_encode.

ashwani-rathee commented 2 years ago

This is almost done for now, I'll merge this after few more checks and fixes tomorrow

ashwani-rathee commented 2 years ago

Currently we are merging this to move forward with JPEG2000 task, quantizer are mostly optmized(have spent quite a bit of time on them already), albeit more time could be spent later.