Alchemy - asynchronous jpeg encoding

9 months ago malczak alchemy comments Bookmark and Share

Just a quick note, motivated by bytearray.org post about fast jpeg encoding. I am preparing a short talk about Alchemy project and, as an example I have developed an asynchronous JPEG encoder. Encouraged by bytearray.org post I have decided to publish (proof-of-concept) solution.

Encoding JPEG with Alchemy is not only fast, but it also produces smaller JPEG images. Just take a look at the example below. I have used an jpeg encoder taken from bytearray.org.
Optimized JPEGEncoder code and post about it can be found at bytearray.org - http://www.bytearray.org/?p=775.

In demo below we encode 2880x2880 BitmapData, showing the difference in time and size between Alchemy libjpeg port and optimized JPEGEncoder. Right click for flex source code. FlashPlayer 10 required.

Flash player (ver. 10.0.0) is required to see this content. Please update to newest possible version.

Get newest Adobe Flash player

When using non asynchronous Alchemy implementation, compression time is much shorter.

But asynchronous implementation is fast enough and can be used particularly in AIR runtime.

Alchemy C code (non optimized, hard coded BitmapData dimensions) is available for download. To compile it You need to recompile libjpeg (http://www.ijg.org/) with Alchemy.

Download Alchemy source file here
Download Alchemy compiled swc library here

For flex source code - right click on application ;)

** update **

This is updated version of libjpeg port. You can now compare JPEG encoding times for alchemy asynchronous, alchemy synchronous, bytearray.org, Kyle Lu and buildin mx.* encoders. The difference in the size of a file can also be noted. Right click for code view.

Flash player (ver. 10.0.0) is required to see this content. Please update to newest possible version.

Get newest Adobe Flash player

Download jpeg swc library source code, libjpeg ported code with compiled library and swc build script here

** update **

Read also post about decoding JPEG images with Alchemy. Used to load bitmap larger than 16MB
http://sflabs.local/devlogs/alchemy-loading-large-jpeg-images

Share |

Comments

9 days ago Robert #0

Hi. The link to the sources doesn't seem to be working.

8 days ago Keyston #1

Anyway to have the sources reposted???

Thanks

6 days ago mxx #2

I've tried in my project to swap the bytearray.org encoder with the alchemy encoder. I've just added a few lines of as3 and imported your swc. It works great but there's an annoying issue: the release build file size of my flex project (Flex 3.4) jumped from 2.4MB to 4MB. Your sample on this page seems to be much lighter.
I browsed several alchemy ports and all of them have a reasonnable swf file size.

did I miss something ?
thanks

New comment

  1. (never shown, just for us for possible contact)

  2. (with http or https prefix)

  3. (use [code][/code] tags to post a code snippet)

  4. (javascript is required)

Website content premeditately commited by segfaultlabs (malczak & sobstel).
Layout by mlando. Icons by DryIcons.com. All rights reserved, of course.