Custom DEFLATE implementation to speed up PNG encoding

I am optimizing the PNG encoder for use in Flash SWF (but I am writing it in Haxe ).

I have so far managed to speed things up, mainly using read / write speed .

During the profiling of my code, I noticed that about 75% of the time is spent on one call to the built-in Flash compress () , which uses the zlib algorithm (which in turn uses DEFLATE).

I'm not too fussy about the compression ratio, but faster compression would be awesome. So, I was wondering if it's worth trying to implement zlib / DEFLATE. A small search led to the source of the C-Zlib implementation, but it doesn’t read the light exactly (or is easy to carry!).

Are there any simple zlib / DEFLATE implementations that I could use as a starting point? I would prefer not to wade through two specifications , especially since I do not know if the implementation running in AVM2 could even perform as fast as native Flash.

+3
source share
3 answers

I finished deflate / zlib implementation from scratch, and just released it, and the PNG encoder that was built on top of it on GitHub ( README ). I also wrote a blog post about a PNG encoder with a test comparing it to other codes.

DeflateStream.hx ( ).

+3

, non-native deflate. , , . , , AS3 JavaScript, https://github.com/dankogai/js-deflate. !

+3

try using fzip or ascompress

+1
source

All Articles